www/js/prod_edit.js

Sun, 27 Jun 2021 11:12:24 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 27 Jun 2021 11:12:24 +0200
changeset 757
d13be50c0049
parent 756
b702c25661e7
child 758
e6814bed4cb1
permissions
-rw-r--r--

Added error handler

741
4ec5de404bc1 Screwed the script
Michiel Broek <mbroek@mbse.eu>
parents: 740
diff changeset
1 /*****************************************************************************
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
2 * Copyright (C) 2018-2021
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
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
24 function createPopupElements() {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
25
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
26 $('#eventWindow').jqxWindow({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
27 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
28 position: { x: 490, y: 210 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
29 width: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
30 height: 175,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
31 resizable: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
32 isModal: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
33 modalOpacity: 0.4,
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
34 autoOpen: false,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
35 okButton: $('#delOk'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
36 cancelButton: $('#delCancel'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
37 initContent: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
38 $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
39 $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
40 $('#delCancel').focus();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
41 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
42 });
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
43
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
44 $('#volumeWindow').jqxWindow({
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
45 theme: theme,
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
46 position: { x: 380, y: 210 },
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
47 width: 500,
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
48 height: 200,
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
49 resizable: false,
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
50 isModal: true,
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
51 modalOpacity: 0.4,
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
52 autoOpen: false,
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
53 cancelButton: $('#volumeReady')
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
54 });
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
55
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
56 $('#pitchrateWindow').jqxWindow({
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
57 theme: theme,
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
58 position: { x: 330, y: 210 },
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
59 width: 600,
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
60 height: 200,
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
61 resizable: false,
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
62 isModal: true,
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
63 modalOpacity: 0.4,
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
64 autoOpen: false,
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
65 cancelButton: $('#pitchrateReady')
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
66 });
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
67
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
68 $('#popupFermentable').jqxWindow({
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
69 width: 800,
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
70 height: 300,
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
71 position: { x: 230, y: 100 },
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
72 resizable: false,
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
73 theme: theme,
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
74 isModal: true,
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
75 autoOpen: false,
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
76 cancelButton: $('#FermentableReady'),
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
77 modalOpacity: 0.40
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
78 });
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
79
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
80 $('#popupHop').jqxWindow({
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
81 width: 800,
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
82 height: 300,
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
83 position: { x: 230, y: 100 },
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
84 resizable: false,
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
85 theme: theme,
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
86 isModal: true,
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
87 autoOpen: false,
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
88 cancelButton: $('#HopReady'),
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
89 modalOpacity: 0.40
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
90 });
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
91
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
92 $('#popupMisc').jqxWindow({
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
93 width: 800,
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
94 height: 275,
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
95 position: { x: 230, y: 100 },
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
96 resizable: false,
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
97 theme: theme,
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
98 isModal: true,
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
99 autoOpen: false,
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
100 cancelButton: $('#MiscReady'),
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
101 modalOpacity: 0.40
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
102 });
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
103
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
104 $('#popupYeast').jqxWindow({
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
105 width: 800,
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
106 height: 300,
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
107 position: { x: 230, y: 100 },
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
108 resizable: false,
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
109 theme: theme,
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
110 isModal: true,
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
111 autoOpen: false,
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
112 cancelButton: $('#YeastReady'),
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
113 modalOpacity: 0.40
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
114 });
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
115
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
116 $('#popupMash').jqxWindow({
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
117 width: 800,
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
118 height: 400,
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
119 position: { x: 230, y: 100 },
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
120 resizable: false,
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
121 theme: theme,
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
122 isModal: true,
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
123 autoOpen: false,
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
124 cancelButton: $('#MashReady'),
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
125 modalOpacity: 0.40
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
126 });
112
7ef48396f705 Added some buttons. Only allow product delete if it has no serious data.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
127 }
7ef48396f705 Added some buttons. Only allow product delete if it has no serious data.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
128
7ef48396f705 Added some buttons. Only allow product delete if it has no serious data.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
129
7ef48396f705 Added some buttons. Only allow product delete if it has no serious data.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
130
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
131 function drop_endis(flag, item, index) {
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
132 (flag) ? $(item).jqxDropDownList('disableAt', index) : $(item).jqxDropDownList('enableAt', index);
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
133 }
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
134
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
135
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
136
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
137 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
138 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
139 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
140 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
141 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
142 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
143 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
144 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
145 }
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
146
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
147
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
148
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
149 function minimum_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
150 if (stage > 5 && added < 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
151 return 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
152 if (stage > 3 && added < 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
153 return 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
154 if (stage > 2 && added < 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
155 return 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
156 return 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
157 }
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
158
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
159
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
160
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
161 function minimum_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
162 {
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
163 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
164 return 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
165 return 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
166 }
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
167
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
168
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
169
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
170 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
171 {
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
172 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
173 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
174 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
175 }
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
176
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
177
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
178
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
179 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
180 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
181 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
182 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
183 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
184 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
185 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
186 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
187 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
188 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
189 }
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
190
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
191
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
192
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
193 function minimum_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
194 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
195 return 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
196 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
197 return 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
198 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
199 return 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
200 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
201 return 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
202 return 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
203 }
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
204
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
205
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
206
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
207 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
208 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
209 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
210 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
211 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
212 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
213 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
214 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
215 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
216 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
217 }
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
218
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
219
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
220
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
221 function minimum_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
222 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
223 return 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
224 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
225 return 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
226 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
227 return 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
228 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
229 return 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
230 return 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
231 }
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
232
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
233
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
234
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
235 $(document).ready(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
236
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
237 var i,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
238 to_100 = false, // Fermentables adjust to 100%
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
239 preboil_sg = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
240 aboil_sg = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
241 est_mash_sg = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
242 psugar = 0, // Percentage real sugars
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
243 pcara = 0, // Percentage cara/crystal malts
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
244 svg = 77, // Default attenuation
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
245 mashkg = 0, // Malt in mash weight
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
246 initcells = 0, // Initial yeast cell count
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
247
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
248 ok_fermentables = 1, // Fermentables are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
249 ok_hops = 1, // Hops are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
250 ok_miscs = 1, // Miscs are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
251 ok_yeasts = 1, // Yeasts are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
252 ok_waters = 1, // Waters are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
253
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
254 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
255 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
256 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
257 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
258 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
259
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
260 hop_flavour = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
261 hop_aroma = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
262 mash_infuse = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
263 last_base = '',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
264 last_acid = '',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
265
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
266 MMCa = 40.048,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
267 MMMg = 24.305,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
268 MMNa = 22.98976928,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
269 MMCl = 35.453,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
270 MMSO4 = 96.0626,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
271 MMHCO3 = 61.01684,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
272 MMCaSO4 = 172.171,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
273 MMCaCl2 = 147.015,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
274 MMCaCO3 = 100.087,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
275 MMMgSO4 = 246.475,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
276 MMNaHCO3 = 84.007,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
277 MMNa2CO3 = 105.996,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
278 MMNaCl = 58.443,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
279 MMCaOH2 = 74.06268,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
280
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
281 fermentableRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
282 fermentableData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
283 fermentableInit = 1,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
284 hopRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
285 hopData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
286 miscRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
287 miscData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
288 yeastRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
289 yeastData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
290 mashRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
291 mashData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
292 Ka1 = 0.0000004445,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
293 Ka2 = 0.0000000000468,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
294 dataRecord = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
295 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
296 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
297 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
298 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
299 SlakingHeat = 10.318, //cal/g.°C
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
300
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
301 // Prepare the data
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
302 source = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
303 datatype: 'json',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
304 cache: false,
638
736c8d29bc87 Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents: 637
diff changeset
305 async: true,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
306 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
307 // From prod_main
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
308 { name: 'record', type: 'number' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
309 { name: 'uuid', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
310 { name: 'name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
311 { name: 'code', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
312 { name: 'birth', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
313 { name: 'stage', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
314 { name: 'notes', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
315 { name: 'log_brew', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
316 { 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
317 { 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
318 { name: 'log_co2pressure', type: 'int' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
319 { name: 'inventory_reduced', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
320 { name: 'locked', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
321 { name: 'eq_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
322 { name: 'eq_boil_size', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
323 { name: 'eq_batch_size', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
324 { name: 'eq_tun_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
325 { name: 'eq_tun_weight', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
326 { name: 'eq_tun_specific_heat', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
327 { name: 'eq_tun_material', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
328 { name: 'eq_tun_height', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
329 { name: 'eq_top_up_water', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
330 { name: 'eq_trub_chiller_loss', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
331 { name: 'eq_evap_rate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
332 { name: 'eq_boil_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
333 { name: 'eq_calc_boil_volume', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
334 { name: 'eq_top_up_kettle', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
335 { name: 'eq_hop_utilization', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
336 { name: 'eq_notes', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
337 { name: 'eq_lauter_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
338 { name: 'eq_lauter_height', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
339 { name: 'eq_lauter_deadspace', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
340 { name: 'eq_kettle_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
341 { name: 'eq_kettle_height', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
342 { name: 'eq_mash_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
343 { name: 'eq_mash_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
344 { name: 'eq_efficiency', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
345 { name: 'brew_date_start', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
346 { name: 'brew_mash_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
347 { name: 'brew_mash_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
348 { name: 'brew_mash_efficiency', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
349 { name: 'brew_sparge_est', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
350 { name: 'brew_sparge_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
351 { name: 'brew_preboil_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
352 { name: 'brew_preboil_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
353 { name: 'brew_preboil_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
354 { name: 'brew_preboil_efficiency', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
355 { name: 'brew_aboil_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
356 { name: 'brew_aboil_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
357 { name: 'brew_aboil_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
358 { name: 'brew_aboil_efficiency', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
359 { name: 'brew_cooling_method', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
360 { name: 'brew_cooling_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
361 { name: 'brew_cooling_to', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
362 { name: 'brew_whirlpool9', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
363 { name: 'brew_whirlpool7', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
364 { name: 'brew_whirlpool6', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
365 { name: 'brew_whirlpool2', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
366 { name: 'brew_fermenter_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
367 { name: 'brew_fermenter_extrawater', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
368 { name: 'brew_fermenter_tcloss', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
369 { name: 'brew_aeration_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
370 { name: 'brew_aeration_speed', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
371 { name: 'brew_aeration_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
372 { name: 'brew_fermenter_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
373 { name: 'brew_fermenter_ibu', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
374 { name: 'brew_fermenter_color', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
375 { name: 'brew_date_end', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
376 { name: 'og', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
377 { name: 'fg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
378 { name: 'primary_start_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
379 { name: 'primary_max_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
380 { name: 'primary_end_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
381 { name: 'primary_end_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
382 { name: 'primary_end_date', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
383 { name: 'secondary_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
384 { name: 'secondary_end_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
385 { name: 'secondary_end_date', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
386 { name: 'tertiary_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
387 { name: 'package_date', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
388 { name: 'package_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
389 { name: 'package_infuse_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
390 { name: 'package_infuse_abv', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
391 { name: 'package_infuse_notes', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
392 { name: 'package_abv', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
393 { name: 'package_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
394 { name: 'bottle_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
395 { name: 'bottle_carbonation', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
396 { name: 'bottle_priming_water', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
397 { name: 'bottle_priming_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
398 { name: 'bottle_carbonation_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
399 { name: 'keg_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
400 { name: 'keg_carbonation', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
401 { name: 'keg_priming_water', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
402 { name: 'keg_priming_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
403 { name: 'keg_carbonation_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
404 { name: 'keg_forced_carb', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
405 { name: 'keg_pressure', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
406 { name: 'taste_notes', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
407 { name: 'taste_rate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
408 { name: 'taste_date', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
409 { name: 'taste_color', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
410 { name: 'taste_transparency', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
411 { name: 'taste_head', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
412 { name: 'taste_aroma', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
413 { name: 'taste_taste', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
414 { name: 'taste_mouthfeel', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
415 { name: 'taste_aftertaste', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
416 { name: 'st_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
417 { name: 'st_letter', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
418 { name: 'st_guide', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
419 { 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
420 { name: 'st_category_number', type: 'int' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
421 { name: 'st_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
422 { name: 'st_og_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
423 { name: 'st_og_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
424 { name: 'st_fg_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
425 { name: 'st_fg_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
426 { name: 'st_ibu_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
427 { name: 'st_ibu_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
428 { name: 'st_color_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
429 { name: 'st_color_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
430 { name: 'st_carb_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
431 { name: 'st_carb_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
432 { name: 'st_abv_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
433 { name: 'st_abv_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
434 { name: 'type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
435 { name: 'batch_size', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
436 { name: 'boil_size', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
437 { name: 'boil_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
438 { name: 'efficiency', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
439 { 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
440 { name: 'est_og3', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
441 { name: 'est_fg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
442 { name: 'est_abv', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
443 { name: 'est_color', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
444 { name: 'color_method', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
445 { name: 'est_ibu', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
446 { name: 'ibu_method', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
447 { name: 'est_carb', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
448 { name: 'sparge_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
449 { name: 'sparge_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
450 { name: 'sparge_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
451 { name: 'sparge_source', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
452 { name: 'sparge_acid_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
453 { name: 'sparge_acid_perc', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
454 { name: 'sparge_acid_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
455 { name: 'mash_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
456 { name: 'mash_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
457 { name: 'calc_acid', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
458 { name: 'w1_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
459 { name: 'w1_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
460 { name: 'w1_calcium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
461 { name: 'w1_sulfate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
462 { name: 'w1_chloride', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
463 { name: 'w1_sodium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
464 { name: 'w1_magnesium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
465 { name: 'w1_total_alkalinity', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
466 { name: 'w1_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
467 { name: 'w1_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
468 { name: 'w2_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
469 { name: 'w2_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
470 { name: 'w2_calcium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
471 { name: 'w2_sulfate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
472 { name: 'w2_chloride', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
473 { name: 'w2_sodium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
474 { name: 'w2_magnesium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
475 { name: 'w2_total_alkalinity', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
476 { name: 'w2_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
477 { name: 'w2_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
478 { name: 'wg_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
479 { name: 'wg_calcium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
480 { name: 'wg_sulfate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
481 { name: 'wg_chloride', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
482 { name: 'wg_sodium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
483 { name: 'wg_magnesium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
484 { name: 'wg_total_alkalinity', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
485 { name: 'wg_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
486 { name: 'wb_calcium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
487 { name: 'wb_sulfate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
488 { name: 'wb_chloride', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
489 { name: 'wb_sodium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
490 { name: 'wb_magnesium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
491 { name: 'wb_total_alkalinity', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
492 { name: 'wb_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
493 { name: 'wa_acid_name', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
494 { name: 'wa_acid_perc', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
495 { name: 'wa_base_name', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
496 { name: 'starter_enable', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
497 { name: 'starter_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
498 { name: 'starter_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
499 { 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
500 { 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
501 { name: 'yeast_pitchrate', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
502 { name: 'prop1_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
503 { name: 'prop1_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
504 { name: 'prop2_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
505 { name: 'prop2_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
506 { name: 'prop3_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
507 { name: 'prop3_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
508 { name: 'prop4_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
509 { name: 'prop4_volume', type: 'float' },
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
510 { name: 'divide_type', type: 'int' },
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
511 { 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
512 { name: 'divide_factor', type: 'float' },
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
513 { 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
514 { name: 'divide_part', type: 'int' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
515 { name: 'fermentables', type: 'array' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
516 { name: 'hops', type: 'array' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
517 { name: 'miscs', type: 'array' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
518 { name: 'yeasts', type: 'array' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
519 { name: 'mashs', type: 'array' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
520 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
521 id: 'record',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
522 url: url + '?record=' + my_record
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
523 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
524
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
525 // Load data and select one record.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
526 dataAdapter = new $.jqx.dataAdapter(source, {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
527 loadComplete: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
528 var records = dataAdapter.records;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
529 dataRecord = records[0];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
530 // Hidden record uuid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
531 $('#name').val(dataRecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
532 $('#code').val(dataRecord.code);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
533 $('#birth').val(dataRecord.birth);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
534 $('#stage').val(StageData[dataRecord.stage].nl);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
535 $('#notes').val(dataRecord.notes);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
536 $('#locked').val(dataRecord.locked);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
537 $('#eq_name').val(dataRecord.eq_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
538 $('#eq_notes').val(dataRecord.eq_notes);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
539 $('#eq_boil_size').val(dataRecord.eq_boil_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
540 $('#eq_batch_size').val(dataRecord.eq_batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
541 $('#eq_tun_volume').val(dataRecord.eq_tun_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
542 $('#eq_top_up_water').val(dataRecord.eq_top_up_water);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
543 $('#eq_trub_chiller_loss').val(dataRecord.eq_trub_chiller_loss);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
544 $('#eq_evap_rate').val(dataRecord.eq_evap_rate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
545 $('#eq_boil_time').val(dataRecord.eq_boil_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
546 $('#eq_top_up_kettle').val(dataRecord.eq_top_up_kettle);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
547 $('#eq_hop_utilization').val(dataRecord.eq_hop_utilization);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
548 $('#eq_lauter_volume').val(dataRecord.eq_lauter_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
549 $('#eq_lauter_deadspace').val(dataRecord.eq_lauter_deadspace);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
550 $('#eq_kettle_volume').val(dataRecord.eq_kettle_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
551 $('#eq_mash_volume').val(dataRecord.eq_mash_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
552 $('#eq_mash_max').val(dataRecord.eq_mash_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
553 $('#eq_efficiency').val(dataRecord.eq_efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
554 // Brewdate
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
555 $('#brew_date_start').val(dataRecord.brew_date_start);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
556 $('#brew_mash_ph').val(dataRecord.brew_mash_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
557 $('#brew_mash_sg').val(dataRecord.brew_mash_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
558 $('#brew_mash_efficiency').val(dataRecord.brew_mash_efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
559 // Header Spoelen en filteren
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
560 $('#brew_sparge_temperature').val(dataRecord.sparge_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
561 $('#brew_sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
562 $('#brew_sparge_est').val(dataRecord.brew_sparge_est);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
563 $('#brew_sparge_ph').val(dataRecord.brew_sparge_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
564 // Header Beluchten
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
565 $('#brew_aeration_type').val(dataRecord.brew_aeration_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
566 $('#brew_aeration_time').val(dataRecord.brew_aeration_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
567 $('#brew_aeration_speed').val(dataRecord.brew_aeration_speed);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
568
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
569 $('#brew_preboil_ph').val(dataRecord.brew_preboil_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
570 $('#brew_preboil_sg').val(dataRecord.brew_preboil_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
571 $('#brew_preboil_volume').val(dataRecord.brew_preboil_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
572 $('#brew_preboil_efficiency').val(dataRecord.brew_preboil_efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
573 // Header Koelen en whirlpoolen
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
574 $('#brew_whirlpool9').val(dataRecord.brew_whirlpool9);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
575 $('#brew_whirlpool7').val(dataRecord.brew_whirlpool7);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
576 $('#brew_whirlpool6').val(dataRecord.brew_whirlpool6);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
577 $('#brew_whirlpool2').val(dataRecord.brew_whirlpool2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
578 // Header Naar gistvat
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
579 $('#brew_fermenter_volume').val(dataRecord.brew_fermenter_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
580 $('#brew_fermenter_sg').val(dataRecord.brew_fermenter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
581 $('#brew_fermenter_sg2').val(dataRecord.brew_fermenter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
582 $('#brew_fermenter_ibu').val(dataRecord.brew_fermenter_ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
583 $('#brew_fermenter_color').val(dataRecord.brew_fermenter_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
584 $('#brew_fermenter_extrawater').val(dataRecord.brew_fermenter_extrawater);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
585 $('#brew_fermenter_tcloss').val(dataRecord.brew_fermenter_tcloss);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
586
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
587 $('#brew_aboil_ph').val(dataRecord.brew_aboil_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
588 $('#brew_aboil_sg').val(dataRecord.brew_aboil_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
589 $('#brew_aboil_volume').val(dataRecord.brew_aboil_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
590 $('#brew_aboil_efficiency').val(dataRecord.brew_aboil_efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
591 // Header Koelen en whirlpoolen
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
592 $('#brew_cooling_to').val(dataRecord.brew_cooling_to);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
593 $('#brew_cooling_method').val(dataRecord.brew_cooling_method);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
594 $('#brew_cooling_time').val(dataRecord.brew_cooling_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
595 // Niks
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
596 $('#brew_date_end').val(dataRecord.brew_date_end);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
597 $('#og').val(dataRecord.og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
598 $('#fg').val(dataRecord.fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
599 $('#primary_start_temp').val(dataRecord.primary_start_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
600 $('#primary_max_temp').val(dataRecord.primary_max_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
601 $('#primary_end_temp').val(dataRecord.primary_end_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
602 $('#primary_end_sg').val(dataRecord.primary_end_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
603 $('#primary_end_date').val(dataRecord.primary_end_date);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
604 $('#secondary_temp').val(dataRecord.secondary_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
605 $('#secondary_end_sg').val(dataRecord.secondary_end_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
606 $('#secondary_end_date').val(dataRecord.secondary_end_date);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
607 $('#tertiary_temp').val(dataRecord.tertiary_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
608 $('#package_date').val(dataRecord.package_date);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
609 $('#package_volume').val(dataRecord.package_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
610 $('#package_infuse_amount').val(dataRecord.package_infuse_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
611 $('#package_infuse_abv').val(dataRecord.package_infuse_abv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
612 $('#package_infuse_notes').val(dataRecord.package_infuse_notes);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
613 $('#package_abv').val(dataRecord.package_abv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
614 $('#package_ph').val(dataRecord.package_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
615 $('#bottle_amount').val(dataRecord.bottle_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
616 $('#bottle_carbonation').val(dataRecord.bottle_carbonation);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
617 $('#bottle_priming_water').val(dataRecord.bottle_priming_water);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
618 $('#bottle_priming_amount').val(dataRecord.bottle_priming_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
619 $('#bottle_carbonation_temp').val(dataRecord.bottle_carbonation_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
620 $('#keg_amount').val(dataRecord.keg_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
621 $('#keg_carbonation').val(dataRecord.keg_carbonation);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
622 $('#keg_priming_water').val(dataRecord.keg_priming_water);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
623 $('#keg_priming_amount').val(dataRecord.keg_priming_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
624 $('#keg_carbonation_temp').val(dataRecord.keg_carbonation_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
625 $('#keg_forced_carb').val(dataRecord.keg_forced_carb);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
626 $('#keg_pressure').val(dataRecord.keg_pressure);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
627 $('#taste_notes').val(dataRecord.taste_notes);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
628 $('#taste_rate').val(dataRecord.taste_rate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
629 $('#taste_date').val(dataRecord.taste_date);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
630 $('#taste_color').val(dataRecord.taste_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
631 $('#taste_transparency').val(dataRecord.taste_transparency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
632 $('#taste_head').val(dataRecord.taste_head);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
633 $('#taste_aroma').val(dataRecord.taste_aroma);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
634 $('#taste_taste').val(dataRecord.taste_taste);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
635 $('#taste_mouthfeel').val(dataRecord.taste_mouthfeel);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
636 $('#taste_aftertaste').val(dataRecord.taste_aftertaste);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
637
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
638 // Recipe
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
639 $('#st_name').val(dataRecord.st_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
640 $('#st_letter').val(dataRecord.st_letter);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
641 $('#st_guide').val(dataRecord.st_guide);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
642 $('#st_category').val(dataRecord.st_category);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
643 $('#st_category_number').val(dataRecord.st_category_number);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
644 $('#st_type').val(StyleTypeData[dataRecord.st_type].nl);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
645 $('#st_og_min').val(dataRecord.st_og_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
646 $('#st_og_max').val(dataRecord.st_og_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
647 $('#st_fg_min').val(dataRecord.st_fg_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
648 $('#st_fg_max').val(dataRecord.st_fg_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
649 $('#st_abv_min').val(dataRecord.st_abv_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
650 $('#st_abv_max').val(dataRecord.st_abv_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
651 $('#st_color_min').val(dataRecord.st_color_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
652 $('#st_color_max').val(dataRecord.st_color_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
653 $('#st_ibu_min').val(dataRecord.st_ibu_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
654 $('#st_ibu_max').val(dataRecord.st_ibu_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
655 $('#st_carb_min').val(dataRecord.st_carb_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
656 $('#st_carb_min2').val(dataRecord.st_carb_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
657 $('#st_carb_max').val(dataRecord.st_carb_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
658 $('#st_carb_max2').val(dataRecord.st_carb_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
659 $('#type').val(dataRecord.type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
660 $('#batch_size').val(dataRecord.batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
661 $('#est_a_vol').val(dataRecord.batch_size * 1.04);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
662 $('#boil_size').val(dataRecord.boil_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
663 $('#est_pre_vol').val(dataRecord.boil_size * 1.04);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
664 $('#boil_time').val(dataRecord.boil_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
665 $('#efficiency').val(dataRecord.efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
666 $('#est_og').val(dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
667 $('#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
668 $('#est_og3').val(dataRecord.est_og3);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
669 $('#est_fg').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
670 $('#est_fg2').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
671 $('#est_fg3').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
672 $('#est_color').val(dataRecord.est_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
673 $('#est_color2').val(dataRecord.est_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
674 $('#est_abv').val(dataRecord.est_abv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
675 $('#color_method').val(dataRecord.color_method);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
676 $('#est_ibu').val(dataRecord.est_ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
677 $('#est_ibu2').val(dataRecord.est_ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
678 $('#ibu_method').val(dataRecord.ibu_method);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
679 $('#est_carb').val(dataRecord.est_carb);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
680 $('#mash_name').val(dataRecord.mash_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
681 $('#mash_ph').val(dataRecord.mash_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
682 $('#sparge_temp').val(dataRecord.sparge_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
683 $('#sparge_ph').val(dataRecord.sparge_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
684 $('#sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
685 $('#sparge_source').val(dataRecord.sparge_source);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
686 $('#sparge_acid_type').val(dataRecord.sparge_acid_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
687 $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
688 $('#sparge_acid_amount').val(dataRecord.sparge_acid_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
689 $('#calc_acid').val(dataRecord.calc_acid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
690 $('#w1_name').val(dataRecord.w1_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
691 $('#w1_amount').val(dataRecord.w1_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
692 $('#w1_calcium').val(dataRecord.w1_calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
693 $('#w1_sulfate').val(dataRecord.w1_sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
694 $('#w1_chloride').val(dataRecord.w1_chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
695 $('#w1_sodium').val(dataRecord.w1_sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
696 $('#w1_magnesium').val(dataRecord.w1_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
697 $('#w1_total_alkalinity').val(dataRecord.w1_total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
698 $('#w1_ph').val(dataRecord.w1_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
699 $('#w1_cost').val(dataRecord.w1_cost);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
700 $('#w2_name').val(dataRecord.w2_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
701 $('#w2_amount').val(dataRecord.w2_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
702 $('#w2_calcium').val(dataRecord.w2_calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
703 $('#w2_sulfate').val(dataRecord.w2_sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
704 $('#w2_chloride').val(dataRecord.w2_chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
705 $('#w2_sodium').val(dataRecord.w2_sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
706 $('#w2_magnesium').val(dataRecord.w2_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
707 $('#w2_total_alkalinity').val(dataRecord.w2_total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
708 $('#w2_ph').val(dataRecord.w2_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
709 $('#w2_cost').val(dataRecord.w2_cost);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
710 $('#wg_amount').val(dataRecord.wg_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
711 $('#wg_calcium').val(dataRecord.wg_calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
712 $('#wg_sulfate').val(dataRecord.wg_sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
713 $('#wg_chloride').val(dataRecord.wg_chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
714 $('#wg_sodium').val(dataRecord.wg_sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
715 $('#wg_magnesium').val(dataRecord.wg_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
716 $('#wg_total_alkalinity').val(dataRecord.wg_total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
717 $('#wg_ph').val(dataRecord.wg_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
718 $('#wb_calcium').val(dataRecord.wb_calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
719 $('#wb_sulfate').val(dataRecord.wb_sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
720 $('#wb_chloride').val(dataRecord.wb_chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
721 $('#wb_sodium').val(dataRecord.wb_sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
722 $('#wb_magnesium').val(dataRecord.wb_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
723 $('#wb_total_alkalinity').val(dataRecord.wb_total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
724 $('#wb_ph').val(dataRecord.wb_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
725 $('#wa_acid_name').val(dataRecord.wa_acid_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
726 $('#wa_acid_perc').val(dataRecord.wa_acid_perc);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
727 $('#wa_base_name').val(dataRecord.wa_base_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
728 $('#starter_type').val(dataRecord.starter_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
729 $('#starter_sg').val(dataRecord.starter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
730 $('#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
731 $('#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
732 $('#yeast_pitchrate').val(dataRecord.yeast_pitchrate);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
733 $('#prop1_type').val(dataRecord.prop1_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
734 $('#prop1_volume').val(dataRecord.prop1_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
735 $('#prop2_type').val(dataRecord.prop2_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
736 $('#prop2_volume').val(dataRecord.prop2_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
737 $('#prop3_type').val(dataRecord.prop3_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
738 $('#prop3_volume').val(dataRecord.prop3_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
739 $('#prop4_type').val(dataRecord.prop4_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
740 $('#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
741 $('#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
742 if (dataRecord.divide_type > 0)
f71079a45f5c More screen improvements. Updated the design README.
Michiel Broek <mbroek@mbse.eu>
parents: 544
diff changeset
743 $('#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
744 else
f71079a45f5c More screen improvements. Updated the design README.
Michiel Broek <mbroek@mbse.eu>
parents: 544
diff changeset
745 $('#divide_batch').val('n.v.t.');
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
746 // 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
747 // 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
748 // 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
749 // hidden divide_part
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
750 editFermentable(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
751 editHop(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
752 editMisc(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
753 editYeast(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
754 editMash(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
755 calcStage();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
756 $('#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
757 data_loaded = 1;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
758 },
640
048932246071 Loading changes
Michiel Broek <mbroek@mbse.eu>
parents: 639
diff changeset
759 loadError: function(jqXHR, status, error) {
639
71c6bbd7d4e6 Yet another debug trick
Michiel Broek <mbroek@mbse.eu>
parents: 638
diff changeset
760 console.log('main data load error: ' + status + ' ' + error);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
761 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
762 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
763
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
764 // Inline fermentables editor
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
765 var editFermentable = function(data) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
766 var fermentableSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
767 localdata: data.fermentables,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
768 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
769 { name: 'f_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
770 { name: 'f_origin', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
771 { name: 'f_supplier', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
772 { name: 'f_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
773 { name: 'f_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
774 { name: 'f_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
775 { name: 'f_yield', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
776 { name: 'f_color', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
777 { name: 'f_coarse_fine_diff', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
778 { name: 'f_moisture', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
779 { name: 'f_diastatic_power', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
780 { name: 'f_protein', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
781 { name: 'f_max_in_batch', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
782 { name: 'f_graintype', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
783 { name: 'f_added', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
784 { name: 'f_dissolved_protein', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
785 { name: 'f_recommend_mash', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
786 { name: 'f_add_after_boil', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
787 { name: 'f_adjust_to_total_100', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
788 { name: 'f_percentage', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
789 { name: 'f_di_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
790 { name: 'f_acid_to_ph_57', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
791 { name: 'f_inventory', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
792 { name: 'f_avail', type: 'int' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
793 ],
644
4654b8ee4690 Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
794 addrow: function(rowid, rowdata, position, commit) { commit(true); },
4654b8ee4690 Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
795 deleterow: function(rowid, commit) { commit(true); },
4654b8ee4690 Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
796 updaterow: function(rowid, rowdata, commit) { commit(true); }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
797 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
798 fermentableAdapter = new $.jqx.dataAdapter(fermentableSource);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
799
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
800 $('#fermentableGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
801 width: 1240,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
802 height: 470,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
803 source: fermentableAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
804 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
805 selectionmode: 'singlerow',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
806 showtoolbar: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
807 rendertoolbar: function(toolbar) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
808 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
809 toolbar.append(container);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
810 container.append('<div style="float: left; margin-left: 165px;" id="faddrowbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
811 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
812 container.append('<div style="float: left; margin-left: 10px;" id="finstockbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
813 container.append('<input style="float: left; margin-left: 400px;" id="fdeleterowbutton" type="button" value="Verwijder mout" />');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
814 // add fermentable from dropdownlist.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
815 $('#faddrowbutton').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
816 placeHolder: 'Kies mout:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
817 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
818 template: 'primary',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
819 source: fermentablelist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
820 displayMember: 'name',
751
3ba26a83eb93 Allow add and delete of fermentables durring valid brew moments. Add and edit a fermantable only to stages that have not yet been done. Block the packaging choices, edited elsewhere.
Michiel Broek <mbroek@mbse.eu>
parents: 741
diff changeset
821 disabled: (dataRecord.stage > 6),
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
822 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
823 height: 27,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
824 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
825 dropDownHeight: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
826 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
827 var datarecord = fermentablelist.records[index];
564
d5fad7d80899 When adding fermentables or hops to a product, show the current inventory in the dropdownlist.
Michiel Broek <mbroek@mbse.eu>
parents: 561
diff changeset
828 return datarecord.supplier + ' / ' + datarecord.name + ' (' + datarecord.color + ' EBC) (' + Round(datarecord.inventory, 3) + ' kg)';
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
829 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
830 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
831 $('#faddrowbutton').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
832 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
833 var index, datarecord, row = {}, rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
834 index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
835 datarecord = fermentablelist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
836 row['f_name'] = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
837 row['f_origin'] = datarecord.origin;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
838 row['f_supplier'] = datarecord.supplier;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
839 row['f_amount'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
840 row['f_cost'] = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
841 row['f_type'] = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
842 row['f_yield'] = datarecord.yield;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
843 row['f_color'] = datarecord.color;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
844 row['f_coarse_fine_diff'] = datarecord.coarse_fine_diff;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
845 row['f_moisture'] = datarecord.moisture;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
846 row['f_diastatic_power'] = datarecord.diastatic_power;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
847 row['f_protein'] = datarecord.protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
848 row['f_max_in_batch'] = datarecord.max_in_batch;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
849 row['f_graintype'] = datarecord.graintype;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
850 if (datarecord.add_after_boil) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
851 row['f_added'] = 2; // Fermentation
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
852 } else if ((datarecord.type == 1) || (datarecord.type == 4)) { // Sugar or Adjunct
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
853 row['f_added'] = 1; // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
854 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
855 row['f_added'] = 0; // Mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
856 }
751
3ba26a83eb93 Allow add and delete of fermentables durring valid brew moments. Add and edit a fermantable only to stages that have not yet been done. Block the packaging choices, edited elsewhere.
Michiel Broek <mbroek@mbse.eu>
parents: 741
diff changeset
857 /* If stage > added moment, adjust the moment */
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
858 row['f_added'] = minimum_fermentable(dataRecord.stage, row['f_added']);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
859 row['f_dissolved_protein'] = datarecord.dissolved_protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
860 row['f_recommend_mash'] = datarecord.recommend_mash;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
861 row['f_add_after_boil'] = datarecord.add_after_boil;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
862 if (rowscount == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
863 // The first fermentable
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
864 row['f_adjust_to_total_100'] = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
865 row['f_percentage'] = 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
866 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
867 row['f_adjust_to_total_100'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
868 row['f_percentage'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
869 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
870 row['f_di_ph'] = datarecord.di_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
871 row['f_acid_to_ph_57'] = datarecord.acid_to_ph_57;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
872 row['f_inventory'] = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
873 $('#fermentableGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
874 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
875 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
876
751
3ba26a83eb93 Allow add and delete of fermentables durring valid brew moments. Add and edit a fermantable only to stages that have not yet been done. Block the packaging choices, edited elsewhere.
Michiel Broek <mbroek@mbse.eu>
parents: 741
diff changeset
877 $('#finstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 6) });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
878 $('#finstockbutton').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
879 fermentableinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
880 fermentablelist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
881 });
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 // delete selected fermentable.
751
3ba26a83eb93 Allow add and delete of fermentables durring valid brew moments. Add and edit a fermantable only to stages that have not yet been done. Block the packaging choices, edited elsewhere.
Michiel Broek <mbroek@mbse.eu>
parents: 741
diff changeset
884 $('#fdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 6) });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
885 $('#fdeleterowbutton').on('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
886 var rowscount, id, percent, amount, i, rowdata,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
887 selectedrowindex = $('#fermentableGrid').jqxGrid('getselectedrowindex');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
888 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
889 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
890 id = $('#fermentableGrid').jqxGrid('getrowid', selectedrowindex);
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
891 added = $('#fermentableGrid').jqxGrid('getcellvalue', selectedrowindex, 'f_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
892 if (block_fermentable(dataRecord.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
893 percent = mount = 0;
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
894 alert('Ingredieënt is al verwerkt.');
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
895 } else {
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
896 percent = $('#fermentableGrid').jqxGrid('getcellvalue', id, 'f_percentage');
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
897 amount = $('#fermentableGrid').jqxGrid('getcellvalue', id, 'f_amount');
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
898 $('#fermentableGrid').jqxGrid('deleterow', id);
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
899 }
478
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 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
902 if (rowscount > 1) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
903 if (to_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
904 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
905 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
906 if (rowdata.f_adjust_to_total_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
907 rowdata.f_percentage += percent;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
908 rowdata.f_amount += amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
909 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
910 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
911 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
912 calcPercentages();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
913 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
914 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
915 $('#fermentableGrid').jqxGrid('setcellvalue', 0, 'f_percentage', 100);
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 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
918 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
919 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
920 },
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 647
diff changeset
921 ready: function() { calcFermentables(); $('#jqxTabs').jqxTabs('next'); },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
922 columns: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
923 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
924 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
925 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + rowdata.f_supplier + ' / ' +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
926 rowdata.f_name + ' (' + rowdata.f_color + ' EBC)</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
927 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
928 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
929 { text: 'Type', width: 100, datafield: 'f_type',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
930 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
931 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
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 { text: 'Moment', width: 110, datafield: 'f_added',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
935 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
936 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
937 }
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 { text: 'Maxinbatch', datafield: 'f_max_in_batch', hidden: true },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
940 { text: 'Opbrengst', datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
941 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
942 { text: 'Voorraad Kg', datafield: 'f_inventory', width: 120, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
943 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
944 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
945 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
946 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
947 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
948 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
949 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
950 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
951 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
952 { text: 'Procent', datafield: 'f_percentage', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
953 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
954 if (rowdata.f_added >= 4)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
955 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
956 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
957 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
958 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
959 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
960 { 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
961 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
962 if (value == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
963 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
964 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
965 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
966 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
967 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
968 cellsrenderer: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
969 return 'Wijzig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
970 }, buttonclick: function(row) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
971 fermentableRow = row;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
972 fermentableData = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
973 if (fermentableData.f_added >= 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
974 alert('Wijzig dit in de Verpakken tab');
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
975 } else if (block_fermentable(dataRecord.stage, fermentableData.f_added)) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
976 alert('Ingredieënt is al verwerkt.');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
977 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
978 $('#wf_name').val(fermentableData.f_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
979 $('#wf_amount').val(fermentableData.f_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
980 $('#wf_percentage').val(fermentableData.f_percentage);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
981 $('#wf_max_in_batch').val(fermentableData.f_max_in_batch);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
982 $('#wf_adjust_to_total_100').val(fermentableData.f_adjust_to_total_100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
983 $('#wf_added').val(fermentableData.f_added);
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
984 drop_endis(dataRecord.stage >= 3, '#wf_added', 0);
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
985 drop_endis(dataRecord.stage >= 3, '#wf_added', 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
986 drop_endis(dataRecord.stage >= 4, '#wf_added', 2);
751
3ba26a83eb93 Allow add and delete of fermentables durring valid brew moments. Add and edit a fermantable only to stages that have not yet been done. Block the packaging choices, edited elsewhere.
Michiel Broek <mbroek@mbse.eu>
parents: 741
diff changeset
987 $('#wf_added').jqxDropDownList('disableAt', 4);
3ba26a83eb93 Allow add and delete of fermentables durring valid brew moments. Add and edit a fermantable only to stages that have not yet been done. Block the packaging choices, edited elsewhere.
Michiel Broek <mbroek@mbse.eu>
parents: 741
diff changeset
988 $('#wf_added').jqxDropDownList('disableAt', 5);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
989 // show the popup window.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
990 $('#popupFermentable').jqxWindow('open');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
991 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
992 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
993 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
994 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
995 });
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
996 };
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
997
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
998 // Inline hops editor
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
999 var editHop = function(data) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1000 var hopSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1001 localdata: data.hops,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1002 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1003 { name: 'h_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1004 { name: 'h_origin', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1005 { name: 'h_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1006 { name: 'h_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1007 { name: 'h_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1008 { name: 'h_form', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1009 { name: 'h_useat', type: 'int' },
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
1010 { name: 'h_time', type: 'int' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1011 { name: 'h_alpha', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1012 { name: 'h_beta', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1013 { name: 'h_hsi', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1014 { name: 'h_humulene', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1015 { name: 'h_caryophyllene', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1016 { name: 'h_cohumulone', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1017 { name: 'h_myrcene', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1018 { name: 'h_total_oil', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1019 { name: 'h_inventory', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1020 { name: 'h_avail', type: 'int' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1021 ],
641
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
1022 addrow: function(rowid, rowdata, position, commit) { commit(true); },
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
1023 deleterow: function(rowid, commit) { commit(true); },
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
1024 updaterow: function(rowid, rowdata, commit) { commit(true); }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1025 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1026 hopAdapter = new $.jqx.dataAdapter(hopSource);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1027
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1028 $('#hopGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1029 width: 1240,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1030 height: 560,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1031 source: hopAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1032 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1033 selectionmode: 'singlerow',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1034 showtoolbar: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1035 rendertoolbar: function(toolbar) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1036 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1037 toolbar.append(container);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1038 container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1039 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1040 container.append('<div style="float: left; margin-left: 10px;" id="hinstockbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1041 container.append('<input style="float: left; margin-left: 400px;" id="hdeleterowbutton" type="button" value="Verwijder hop" />');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1042 // add hop from dropdownlist.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1043 $('#haddrowbutton').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1044 placeHolder: 'Kies hop:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1045 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1046 template: 'primary',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1047 source: hoplist,
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
1048 disabled: (dataRecord.stage > 5),
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1049 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1050 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1051 height: 27,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1052 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1053 dropDownHeight: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1054 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1055 var datarecord = hoplist.records[index];
564
d5fad7d80899 When adding fermentables or hops to a product, show the current inventory in the dropdownlist.
Michiel Broek <mbroek@mbse.eu>
parents: 561
diff changeset
1056 return datarecord.origin + ' - ' + datarecord.name + ' / ' + HopFormData[datarecord.form].nl + ' (' + datarecord.alpha + '% &alpha;) (' +
d5fad7d80899 When adding fermentables or hops to a product, show the current inventory in the dropdownlist.
Michiel Broek <mbroek@mbse.eu>
parents: 561
diff changeset
1057 Round(datarecord.inventory * 1000.0, 1) + ' gr)';
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1058 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1059 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1060 $('#haddrowbutton').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1061 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1062 var datarecord, row = {}, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1063 datarecord = hoplist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1064 row['h_name'] = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1065 row['h_origin'] = datarecord.origin;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1066 row['h_amount'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1067 row['h_cost'] = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1068 row['h_type'] = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1069 row['h_form'] = datarecord.form;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1070 row['h_useat'] = 2; // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1071 row['h_time'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1072 row['h_alpha'] = datarecord.alpha;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1073 row['h_beta'] = datarecord.beta;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1074 row['h_hsi'] = datarecord.hsi;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1075 row['h_humulene'] = datarecord.humulene;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1076 row['h_caryophyllene'] = datarecord.caryophyllene;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1077 row['h_cohumulone'] = datarecord.cohumulone;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1078 row['h_myrcene'] = datarecord.myrcene;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1079 row['h_total_oil'] = datarecord.total_oil;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1080 row['h_inventory'] = datarecord.inventory;
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
1081 /* If stage > useat moment, adjust the moment */
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
1082 row['h_useat'] = minimum_hop(dataRecord.stage, row['h_useat']);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1083 $('#hopGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1084 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1085 $('#haddrowbutton').jqxDropDownList('clearSelection');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1086 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1087
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
1088 $('#hinstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 5) });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1089 $('#hinstockbutton').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1090 hopinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1091 hoplist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1092 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1093
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1094 // delete selected hop.
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
1095 $('#hdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 5) });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1096 $('#hdeleterowbutton').on('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1097 var rowscount, id, selectedrowindex = $('#hopGrid').jqxGrid('getselectedrowindex');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1098 rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1099 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
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
1100 useat = $('#hopGrid').jqxGrid('getcellvalue', selectedrowindex, 'h_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
1101 if (block_hop(dataRecord.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
1102 alert('Ingredieënt is al verwerkt.');
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
1103 } else {
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
1104 id = $('#hopGrid').jqxGrid('getrowid', selectedrowindex);
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
1105 $('#hopGrid').jqxGrid('deleterow', id);
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
1106 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1107 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1108 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1109 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1110 },
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 647
diff changeset
1111 ready: function() { $('#jqxTabs').jqxTabs('next'); },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1112 columns: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1113 { text: 'Hop', datafield: 'h_name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1114 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1115 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + rowdata.h_origin + ' / ' + rowdata.h_name + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1116 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1117 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1118 { text: 'Type', width: 90, datafield: 'h_type',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1119 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1120 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
1121 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1122 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1123 { text: 'Vorm', width: 90, datafield: 'h_form',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1124 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1125 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
1126 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1127 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1128 { 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
1129 { text: 'Gebruik', width: 110, datafield: 'h_useat',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1130 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1131 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
1132 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1133 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1134 { text: 'Tijdsduur', datafield: 'h_time', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1135 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1136 var duration = '';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1137 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
1138 duration = dataAdapter.formatNumber(value, 'f0') + ' min.';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1139 else if (rowdata.h_useat == 5) // Dry hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1140 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1141 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
1142 }
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 { text: 'IBU', datafield: 'ibu', width: 80, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1145 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1146 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')),
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
1147 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), parseFloat(rowdata.h_alpha), $('#ibu_method').val(),
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
1148 dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1149 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
1150 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1151 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1152 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1153 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1154 var amount = dataAdapter.formatNumber(value, 'f1') + ' kg';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1155 if (value < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1156 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1157 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
1158 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1159 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1160 { text: 'Voorraad', datafield: 'h_inventory', width: 110, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1161 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
1162 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
1163 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
1164 color = (value < rowdata.h_amount) ? '#ff4040':'#ffffff';
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1165 if (value < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1166 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1167 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
1168 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1169 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1170 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1171 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1172 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1173 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1174 cellsrenderer: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1175 return 'Wijzig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1176 }, buttonclick: function(row) {
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
1177 hopRow = row;
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
1178 hopData = $('#hopGrid').jqxGrid('getrowdata', hopRow);
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
1179 if (block_hop(dataRecord.stage, hopData.h_useat)) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1180 alert('Ingredieënt is al verwerkt.');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1181 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1182 console.log('edit button row ' + row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1183 $('#wh_name').val(hopData.h_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1184 $('#wh_amount').val(hopData.h_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1185 var ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')),
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
1186 parseFloat(hopData.h_amount), parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val(),
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
1187 dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1188 $('#wh_ibu').val(ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1189 if (hopData.h_useat == 5) // Dry hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1190 $('#wh_time').val(hopData.h_time / 1440);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1191 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1192 $('#wh_time').val(hopData.h_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1193 $('#wh_useat').val(hopData.h_useat);
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
1194 for (i = 0; i < 5; i++) {
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
1195 drop_endis(dataRecord.stage > 2, '#wh_useat', i);
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
1196 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1197 // show the popup window.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1198 $('#popupHop').jqxWindow('open');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1199 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1200 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1201 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1202 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1203 });
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
1204 };
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1205
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1206 // Inline miscs editor
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
1207 var editMisc = function(data) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1208 var miscSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1209 localdata: data.miscs,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1210 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1211 { name: 'm_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1212 { name: 'm_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1213 { name: 'm_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1214 { name: 'm_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1215 { name: 'm_use_use', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1216 { name: 'm_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1217 { name: 'm_amount_is_weight', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1218 { name: 'm_inventory', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1219 { name: 'm_avail', type: 'int' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1220 ],
641
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
1221 addrow: function(rowid, rowdata, position, commit) { commit(true); },
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
1222 deleterow: function(rowid, commit) { commit(true); },
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
1223 updaterow: function(rowid, rowdata, commit) { commit(true); }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1224 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1225 miscAdapter = new $.jqx.dataAdapter(miscSource, {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1226 beforeLoadComplete: function(records) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1227 var row, i, data = new Array();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1228 for (i = 0; i < records.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1229 row = records[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1230 data.push(row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1231 // Initial set water agent values.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1232 switch (row.m_name) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1233 case 'CaCl2':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1234 $('#wa_cacl2').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1235 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1236 case 'CaSO4':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1237 $('#wa_caso4').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1238 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1239 case 'MgSO4':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1240 $('#wa_mgso4').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1241 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1242 case 'NaCl':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1243 $('#wa_nacl').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1244 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1245 case 'Melkzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1246 $('#wa_acid_name').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1247 $('#wa_acid').val(row.m_amount * 1000);
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
1248 $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc); // TODO: this ignores changed percentages.
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1249 last_acid = 'Melkzuur';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1250 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1251 case 'Zoutzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1252 $('#wa_acid_name').val(1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1253 $('#wa_acid').val(row.m_amount * 1000);
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
1254 $('#wa_acid_perc').val(AcidTypeData[1].AcidPrc);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1255 last_acid = 'Zoutzuur';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1256 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1257 case 'Fosforzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1258 $('#wa_acid_name').val(2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1259 $('#wa_acid').val(row.m_amount * 1000);
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
1260 $('#wa_acid_perc').val(AcidTypeData[2].AcidPrc);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1261 last_acid = 'Fosforzuur';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1262 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1263 case 'Zwavelzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1264 $('#wa_acid_name').val(3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1265 $('#wa_acid').val(row.m_amount * 1000);
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
1266 $('#wa_acid_perc').val(AcidTypeData[3].AcidPrc);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1267 last_acid = 'Zwavelzuur';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1268 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1269 case 'NaHCO3':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1270 $('#wa_base_name').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1271 $('#wa_base').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1272 last_base = 'NaHCO3';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1273 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1274 case 'Na2CO3':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1275 $('#wa_base_name').val(1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1276 $('#wa_base').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1277 last_base = 'Na2CO3';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1278 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1279 case 'CaCO3':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1280 $('#wa_base_name').val(2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1281 $('#wa_base').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1282 last_base = 'CaCO3';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1283 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1284 case 'Ca(OH)2':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1285 $('#wa_base_name').val(3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1286 $('#wa_base').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1287 last_base = 'Ca(OH)2';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1288 break;
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 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1291 return data;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1292 },
641
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
1293 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
1294 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1295 $('#miscGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1296 width: 1240,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1297 height: 575,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1298 source: miscAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1299 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1300 selectionmode: 'singlerow',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1301 showtoolbar: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1302 rendertoolbar: function(toolbar) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1303 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1304 toolbar.append(container);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1305 container.append('<div style="float: left; margin-left: 165px;" id="maddrowbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1306 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1307 container.append('<div style="float: left; margin-left: 10px;" id="minstockbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1308 container.append('<input style="float: left; margin-left: 400px;" id="mdeleterowbutton" type="button" value="Verwijder ingredient" />');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1309 // add misc from dropdownlist.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1310 $('#maddrowbutton').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1311 placeHolder: 'Kies ingredi&euml;nt:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1312 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1313 template: 'primary',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1314 source: misclist,
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
1315 disabled: (dataRecord.stage > 6),
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1316 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1317 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1318 height: 27,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1319 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1320 dropDownHeight: 500
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 $('#maddrowbutton').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1323 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1324 var datarecord, row = {}, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1325 datarecord = misclist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1326 row['m_name'] = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1327 row['m_amount'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1328 row['m_cost'] = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1329 row['m_type'] = datarecord.type;
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
1330 row['m_use_use'] = minimum_misc(dataRecord.stage, datarecord.use_use);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1331 row['m_time'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1332 row['m_amount_is_weight'] = datarecord.amount_is_weight;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1333 row['m_inventory'] = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1334 $('#miscGrid').jqxGrid('addrow', null, row);
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 });
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
1337 $('#minstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 6) });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1338 $('#minstockbutton').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1339 miscinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1340 misclist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1341 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1342 // delete selected misc.
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
1343 $('#mdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 6) });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1344 $('#mdeleterowbutton').on('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1345 var rowscount, type, id, selectedrowindex = $('#miscGrid').jqxGrid('getselectedrowindex');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1346 rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1347 type = $('#miscGrid').jqxGrid('getcellvalue', selectedrowindex, 'm_type');
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
1348 use_use = $('#miscGrid').jqxGrid('getcellvalue', selectedrowindex, 'm_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
1349 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type == 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
1350 alert('Brouwzouten verwijderen in de water tab.');
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
1351 } else if (block_misc(dataRecord.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
1352 alert('Ingredieënt is al verwerkt.');
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
1353 } else {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1354 id = $('#miscGrid').jqxGrid('getrowid', selectedrowindex);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1355 $('#miscGrid').jqxGrid('deleterow', id);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1356 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1357 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1358 },
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 647
diff changeset
1359 ready: function() { $('#jqxTabs').jqxTabs('next'); },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1360 columns: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1361 { text: 'Ingredient', datafield: 'm_name' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1362 { text: 'Type', width: 140, datafield: 'm_type',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1363 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1364 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
1365 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1366 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1367 { text: 'Gebruik', width: 140, datafield: 'm_use_use',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1368 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1369 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
1370 }
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 { text: 'Tijd', datafield: 'm_time', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1373 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1374 var duration = '';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1375 if (rowdata.m_use_use == 2) // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1376 duration = dataAdapter.formatNumber(value, 'f0') + ' min.';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1377 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
1378 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1379 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
1380 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1381 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1382 { text: 'Hoeveel', datafield: 'm_amount', width: 110, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1383 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1384 var vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1385 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
1386 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1387 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1388 { text: 'Voorraad', datafield: 'm_inventory', width: 110, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1389 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
1390 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
1391 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
1392 color = (value < rowdata.m_amount) ? '#ff4040':'#ffffff',
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1393 amount = dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1394 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
1395 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1396 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1397 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1398 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1399 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1400 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1401 cellsrenderer: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1402 return 'Wijzig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1403 }, buttonclick: function(row) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1404 miscRow = row;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1405 miscData = $('#miscGrid').jqxGrid('getrowdata', miscRow);
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
1406 if (block_misc(dataRecord.stage, miscData.m_use_use)) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1407 alert('Ingredieënt is al verwerkt.');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1408 } else if (miscData.m_type == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1409 alert('Brouwzouten wijzigen in de water tab.');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1410 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1411 console.log('edit button row ' + row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1412 if (miscData.m_amount_is_weight)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1413 $('#wm_pmpt_amount').html('Gewicht gram:');
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 $('#wm_pmpt_amount').html('Volume ml:');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1416 $('#wm_name').val(miscData.m_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1417 $('#wm_amount').val(miscData.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1418 if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) // Primary or Secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1419 $('#wm_time').val(miscData.m_time / 1440);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1420 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1421 $('#wm_time').val(miscData.m_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1422 $('#wm_use_use').val(miscData.m_use_use);
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
1423 drop_endis(dataRecord.stage >= 2, '#wm_use_use', 0);
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
1424 drop_endis(dataRecord.stage >= 3, '#wm_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
1425 drop_endis(dataRecord.stage >= 3, '#wm_use_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
1426 drop_endis(dataRecord.stage >= 4, '#wm_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
1427 drop_endis(dataRecord.stage >= 5, '#wm_use_use', 4);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1428 // show the popup window.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1429 $('#popupMisc').jqxWindow('open');
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 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1432 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1433 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1434 });
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
1435 };
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1436
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1437 // Inline yeasts editor
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
1438 var editYeast = function(data) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1439 var yeastSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1440 localdata: data.yeasts,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1441 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1442 { name: 'y_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1443 { name: 'y_laboratory', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1444 { name: 'y_product_id', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1445 { name: 'y_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1446 { name: 'y_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1447 { name: 'y_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1448 { name: 'y_form', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1449 { name: 'y_flocculation', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1450 { name: 'y_min_temperature', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1451 { name: 'y_max_temperature', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1452 { name: 'y_attenuation', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1453 { name: 'y_use', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1454 { name: 'y_cells', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1455 { name: 'y_tolerance', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1456 { 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
1457 { 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
1458 { 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
1459 { 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
1460 { 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
1461 { 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
1462 { 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
1463 { name: 'y_zymocide', type: 'int' },
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1464 { name: 'y_gr_hl_lo', type: 'int' },
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1465 { name: 'y_sg_lo', type: 'float' },
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1466 { name: 'y_gr_hl_hi', type: 'int' },
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1467 { name: 'y_sg_hi', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1468 { name: 'y_avail', type: 'int' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1469 ],
641
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
1470 addrow: function(rowid, rowdata, position, commit) { commit(true); },
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
1471 deleterow: function(rowid, commit) { commit(true); },
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
1472 updaterow: function(rowid, rowdata, commit) { commit(true); }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1473 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1474 yeastAdapter = new $.jqx.dataAdapter(yeastSource);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1475
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1476 $('#yeastGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1477 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
1478 height: 325,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1479 source: yeastAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1480 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1481 selectionmode: 'singlerow',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1482 showtoolbar: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1483 rendertoolbar: function(toolbar) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1484 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1485 toolbar.append(container);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1486 container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1487 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1488 container.append('<div style="float: left; margin-left: 10px;" id="yinstockbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1489 container.append('<input style="float: left; margin-left: 400px;" id="ydeleterowbutton" type="button" value="Verwijder gist" />');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1490 // add yeast from dropdownlist.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1491 $('#yaddrowbutton').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1492 placeHolder: 'Kies gist:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1493 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1494 source: yeastlist,
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
1495 disabled: (dataRecord.stage > 6),
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1496 template: 'primary',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1497 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1498 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1499 height: 27,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1500 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1501 dropDownHeight: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1502 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1503 var datarecord = yeastlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1504 return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1505 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1506 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1507 $('#yaddrowbutton').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1508 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1509 var datarecord, row = {}, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1510 datarecord = yeastlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1511 row['y_name'] = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1512 row['y_laboratory'] = datarecord.laboratory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1513 row['y_product_id'] = datarecord.product_id;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1514 row['y_type'] = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1515 row['y_form'] = datarecord.form;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1516 row['y_amount'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1517 row['y_cost'] = datarecord.cost;
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
1518 row['y_use'] = minimum_yeast(dataRecord.stage, 0);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1519 row['y_min_temperature'] = datarecord.min_temperature;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1520 row['y_max_temperature'] = datarecord.max_temperature;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1521 row['y_attenuation'] = datarecord.attenuation;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1522 row['y_flocculation'] = datarecord.flocculation;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1523 row['y_cells'] = datarecord.cells;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1524 row['y_tolerance'] = datarecord.tolerance;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1525 row['y_inventory'] = datarecord.inventory;
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
1526 row['y_sta1'] = datarecord.sta1;
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
1527 row['y_bacteria'] = datarecord.bacteria;
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
1528 row['y_harvest_top'] = datarecord.harvest_top;
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
1529 row['y_harvest_time'] = datarecord.harvest_time;
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
1530 row['y_pitch_temperature'] = datarecord.pitch_temperature;
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
1531 row['y_pofpos'] = datarecord.pofpos;
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
1532 row['y_zymocide'] = datarecord.zymocide;
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1533 row['y_gr_hl_lo'] = datarecord.gr_hl_lo;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1534 row['y_sg_lo'] = datarecord.sg_lo;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1535 row['y_gr_hl_hi'] = datarecord.gr_hl_hi;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1536 row['y_sg_hi'] = datarecord.sg_hi;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1537 $('#yeastGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1538 }
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
1539 calcViability();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1540 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1541 $('#yaddrowbutton').jqxDropDownList('clearSelection');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1542 });
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
1543 $('#yinstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 6) });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1544 $('#yinstockbutton').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1545 yeastinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1546 yeastlist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1547 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1548 // delete selected yeast.
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
1549 $('#ydeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 6) });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1550 $('#ydeleterowbutton').on('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1551 var id, rowscount, selectedrowindex = $('#yeastGrid').jqxGrid('getselectedrowindex');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1552 rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1553 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
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
1554 use = $('#yeastGrid').jqxGrid('getcellvalue', selectedrowindex, 'y_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
1555 if (block_yeast(dataRecord.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
1556 alert('Ingredieënt is al verwerkt.');
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
1557 } else {
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
1558 id = $('#yeastGrid').jqxGrid('getrowid', selectedrowindex);
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
1559 $('#yeastGrid').jqxGrid('deleterow', id);
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
1560 calcViability();
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
1561 calcYeast();
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
1562 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1563 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1564 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1565 },
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 647
diff changeset
1566 ready: function() { $('#jqxTabs').jqxTabs('next'); },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1567 columns: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1568 { text: 'Gist', datafield: 'y_name' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1569 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1570 { text: 'Code', width: 90, datafield: 'y_product_id' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1571 { text: 'Soort', width: 100, datafield: 'y_form',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1572 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1573 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
1574 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1575 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1576 { 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
1577 { 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
1578 { 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
1579 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
1580 var amount = '', color = (dataRecord.est_abv > value) ? '#ff4040':'#ffffff';
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1581 if (value > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1582 amount = dataAdapter.formatNumber(value, 'f1');
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 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
1585 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1586 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1587 { 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
1588 { text: 'Voor', width: 120, datafield: 'y_use',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1589 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1590 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
1591 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1592 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1593 { text: 'Hoeveel', datafield: 'y_amount', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1594 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1595 var amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1596 if (rowdata.y_form == 0) // Liquid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1597 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
1598 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
1599 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1600 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
1601 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1602 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1603 { text: 'Voorraad', datafield: 'y_inventory', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1604 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1605 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
1606 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
1607 color = '#ffffff';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1608 if (value < rowdata.y_amount)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1609 color = '#ff4040';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1610 amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1611 if (rowdata.y_form == 0) // Liquid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1612 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
1613 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
1614 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1615 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
1616 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1617 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1618 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1619 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1620 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1621 { text: '', datafield: 'Edit', columntype: 'button', width: 90, align: 'center',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1622 cellsrenderer: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1623 return 'Wijzig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1624 }, buttonclick: function(row) {
707
8488195b3c50 Edit a yeast row now checks the project stage and the use moment to allow edit.
Michiel Broek <mbroek@mbse.eu>
parents: 706
diff changeset
1625 yeastRow = row;
8488195b3c50 Edit a yeast row now checks the project stage and the use moment to allow edit.
Michiel Broek <mbroek@mbse.eu>
parents: 706
diff changeset
1626 yeastData = $('#yeastGrid').jqxGrid('getrowdata', yeastRow);
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
1627 if (block_yeast(dataRecord.stage, yeastData.y_use)) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1628 alert('Ingredieënt is al verwerkt.');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1629 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1630 if (yeastData.y_form == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1631 $('#wy_pmpt_amount').html('Pak(ken):');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1632 $('#wy_amount').val(yeastData.y_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1633 $('#wy_amount').jqxNumberInput({ decimalDigits: 0 });
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
1634 } else if (yeastData.y_form == 1 || yeastData.y_form == 6) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1635 $('#wy_pmpt_amount').html('Gewicht gram:');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1636 $('#wy_amount').val(yeastData.y_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1637 $('#wy_amount').jqxNumberInput({ decimalDigits: 1 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1638 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1639 $('#wy_pmpt_amount').html('Volume ml:');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1640 $('#wy_amount').val(yeastData.y_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1641 $('#wy_amount').jqxNumberInput({ decimalDigits: 0 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1642 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1643 $('#wy_name').val(yeastData.y_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1644 $('#wy_laboratory').val(yeastData.y_laboratory);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1645 $('#wy_product_id').val(yeastData.y_product_id);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1646 $('#wy_use').val(yeastData.y_use);
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
1647 drop_endis(dataRecord.stage > 3, '#wy_use', 0);
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
1648 drop_endis(dataRecord.stage > 4, '#wy_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
1649 drop_endis(dataRecord.stage > 5, '#wy_use', 2);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1650 // show the popup window.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1651 $('#popupYeast').jqxWindow('open');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1652 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1653 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1654 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1655 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1656 });
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
1657 };
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1658
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1659 // inline mash editor
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
1660 var editMash = function(data) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1661 var mashSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1662 localdata: data.mashs,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1663 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1664 { name: 'step_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1665 { 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
1666 { name: 'step_volume', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1667 { 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
1668 { name: 'step_infuse_temp', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1669 { name: 'step_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1670 { 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
1671 { name: 'step_wg_ratio', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1672 { 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
1673 { 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
1674 { 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
1675 { name: 'step_sg', type: 'float' }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1676 ],
644
4654b8ee4690 Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1677 addrow: function(rowid, rowdata, position, commit) { commit(true); },
4654b8ee4690 Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1678 deleterow: function(rowid, commit) { commit(true); }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1679 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1680 mashAdapter = new $.jqx.dataAdapter(mashSource, {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1681 beforeLoadComplete: function(records) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1682 mash_infuse = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1683 var i, row, data = new Array();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1684 for (i = 0; i < records.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1685 row = records[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1686 if (row.step_type == 0) // Infusion
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1687 mash_infuse += parseFloat(row.step_infuse_amount);
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1688 row.step_wg_ratio = 0; // Init this field.
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1689 data.push(row);
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 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1692 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1693 $('#mashGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1694 width: 1240,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1695 height: 400,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1696 source: mashAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1697 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1698 selectionmode: 'singlerow',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1699 showtoolbar: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1700 rendertoolbar: function(toolbar) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1701 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1702 toolbar.append(container);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1703 container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1704 container.append('<input style="float: left; margin-left: 565px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1705 $('#saddrowbutton').jqxButton({ template: 'primary', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1706 $('#saddrowbutton').on('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1707 var row = {}, rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1708 row['step_name'] = 'Stap ' + (rowscount + 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1709 if (rowscount > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1710 row['step_type'] = 1;
740
04c0e444e48e Upgrade mash steps when loading a product. Mash steps Brix input doesn't need wort correction. Added measure data input on the checklist for the first mash step.
Michiel Broek <mbroek@mbse.eu>
parents: 738
diff changeset
1711 row['step_infuse_amount'] = 0.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
1712 row['step_volume'] = mash_infuse;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1713 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1714 row['step_type'] = 0;
740
04c0e444e48e Upgrade mash steps when loading a product. Mash steps Brix input doesn't need wort correction. Added measure data input on the checklist for the first mash step.
Michiel Broek <mbroek@mbse.eu>
parents: 738
diff changeset
1715 row['step_infuse_amount'] = 15.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
1716 row['step_volume'] = 15;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1717 }
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
1718 row['step_infuse_temp'] = 0;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1719 row['step_temp'] = 62.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1720 row['step_time'] = 20.0;
740
04c0e444e48e Upgrade mash steps when loading a product. Mash steps Brix input doesn't need wort correction. Added measure data input on the checklist for the first mash step.
Michiel Broek <mbroek@mbse.eu>
parents: 738
diff changeset
1721 row['step_wg_ratio'] = 0.0;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1722 row['ramp_time'] = 1.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1723 row['end_temp'] = 62.0;
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
1724 row['step_ph'] = 0.0;
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
1725 row['step_sg'] = 0.0;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1726 $('#mashGrid').jqxGrid('addrow', null, row);
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
1727 calcMash();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1728 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1729 // delete selected step.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1730 $('#sdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1731 $('#sdeleterowbutton').on('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1732 var rowscount, id, selectedrowindex = $('#mashGrid').jqxGrid('getselectedrowindex');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1733 rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1734 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1735 id = $('#mashGrid').jqxGrid('getrowid', selectedrowindex);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1736 $('#mashGrid').jqxGrid('deleterow', id);
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
1737 calcMash();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1738 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1739 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1740 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1741 ready: function() {
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1742 /* Calculate the whole recipe */
641
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
1743 console.log('ready mashs, start calculations');
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1744 calcFermentables();
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1745 whirlpoolHops();
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1746 calcIBUs();
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1747 calcMiscs();
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1748 calcViability();
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1749 showStarter();
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1750 calcYeast();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1751 calcInit();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1752 calcMash();
658
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1753 kookTijd();
641
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
1754 console.log('calculations ready');
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1755 $('#jqxLoader').jqxLoader('close');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1756 $('#jqxTabs').jqxTabs('first');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1757 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1758 columns: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1759 { 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
1760 { text: 'Stap type', datafield: 'step_type', width: 150,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1761 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1762 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
1763 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1764 },
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
1765 { 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
1766 { 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
1767 { 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
1768 { 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
1769 { 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
1770 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
1771 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
1772 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
1773 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
1774 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
1775 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
1776 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
1777 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
1778 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1779 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1780 { 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
1781 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
1782 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
1783 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
1784 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
1785 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1786 },
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
1787 { 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
1788 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
1789 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
1790 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
1791 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
1792 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
1793 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1794 },
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
1795 { text: 'pH', datafield: 'step_ph', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f2' },
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
1796 { text: 'SG', datafield: 'step_sg', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
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
1797 { text: '', columntype: 'button', width: 15, align: 'center',
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1798 cellsrenderer: function(row) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1799 if (row < 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
1800 return ' ';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1801 return 'â–´';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1802 }, buttonclick: function(row) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1803 if (row >= 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
1804 swapMash(row, row-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
1805 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1806 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1807 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1808 { text: '', columntype: 'button', width: 15, align: 'center',
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1809 cellsrenderer: function(row) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1810 rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1811 if (row < 1 || row > (rowscount -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
1812 return ' ';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1813 return 'â–¾';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1814 }, buttonclick: function(row) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1815 rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1816 if (row >= 1 && row <= (rowscount -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
1817 swapMash(row, row+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
1818 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1819 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1820 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1821 { text: '', datafield: 'Edit', columntype: 'button', width: 80, align: 'center',
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1822 cellsrenderer: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1823 return 'Wijzig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1824 }, buttonclick: function(row) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1825 if (dataRecord.stage > 3) {
557
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
1826 alert('Het maischen is al gedaan.');
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1827 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1828 mashRow = row;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1829 mashData = $('#mashGrid').jqxGrid('getrowdata', mashRow);
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
1830 if (mashRow == 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
1831 $("#wstep_type").jqxDropDownList('disableAt', 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
1832 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
1833 $("#wstep_type").jqxDropDownList('enableAt', 2);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1834 $('#wstep_name').val(mashData.step_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1835 $('#wstep_type').val(mashData.step_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1836 $('#wstep_infuse_amount').val(mashData.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
1837 $('#wstep_infuse_temp').val(mashData.step_infuse_temp);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1838 $('#wstep_temp').val(mashData.step_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1839 $('#wend_temp').val(mashData.end_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1840 $('#wstep_time').val(mashData.step_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1841 $('#wramp_time').val(mashData.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
1842 $('#wstep_infuse_amount').hide(); // Hide all untile we need it.
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1843 $('#wstep_infuse_temp').hide();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1844 $('#wstep_pmpt_amount').hide();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1845 $('#wstep_pmpt_temp').hide();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1846 if (mashData.step_type == 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
1847 if (mashRow == 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
1848 $('#wstep_infuse_amount').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1849 $('#wstep_pmpt_amount').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1850 } 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
1851 $('#wstep_infuse_temp').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1852 $('#wstep_pmpt_temp').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1853 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1854 }
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
1855 $('#wstep_ph').val(mashData.step_ph);
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
1856 $('#wstep_sg').val(mashData.step_sg);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1857 // show the popup window.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1858 $('#popupMash').jqxWindow('open');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1859 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1860 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1861 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1862 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1863 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1864 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1865
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1866 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1867 * Remove the top menu so that we MUST use the buttons to leave the editor.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1868 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1869 $('#jqxMenu').jqxMenu('destroy');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1870 console.log('record:' + my_record + ' return:' + my_return + ' theme:' + theme);
557
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
1871 $('#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
1872 $('#jqxLoader').jqxLoader('open');
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1873
638
736c8d29bc87 Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents: 637
diff changeset
1874 /* 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
1875 dataAdapter.dataBind();
736c8d29bc87 Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents: 637
diff changeset
1876
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1877 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1878 * Generic functions
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1879 */
658
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1880 function kookTijd() {
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1881 if (dataRecord.boil_time) {
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1882 $('#brew_pmpt_koken').html('Koken ' + dataRecord.boil_time + ' minuten');
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1883 } else {
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1884 $('#brew_pmpt_koken').html('Koken "no-boil"');
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1885 }
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1886 }
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1887
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
1888 function swapMash(r1, r2) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1889
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1890 console.log('swap mash rows ' + r1 + ' ' + r2);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1891 var row1 = $('#mashGrid').jqxGrid('getrowdata', r1);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1892 var row2 = $('#mashGrid').jqxGrid('getrowdata', r2);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1893 var obj1 = { step_name: row1.step_name, step_type: row1.step_type, step_volume: row1.step_volume, step_infuse_amount: row1.step_infuse_amount,
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1894 step_infuse_temp: row1.step_infuse_temp, step_temp: row1.step_temp, step_time: row1.step_time,
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
1895 ramp_time: row1.ramp_time, end_temp: row1.end_temp, step_wg_ratio: row1.step_wg_ratio, step_ph: row1.step_ph, step_sg: row1.step_sg };
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
1896 var obj2 = { step_name: row2.step_name, step_type: row2.step_type, step_volume: row2.step_volume, step_infuse_amount: row2.step_infuse_amount,
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1897 step_infuse_temp: row2.step_infuse_temp, step_temp: row2.step_temp, step_time: row2.step_time,
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
1898 ramp_time: row2.ramp_time, end_temp: row2.end_temp, step_wg_ratio: row2.step_wg_ratio, step_ph: row2.step_ph, step_sg: row2.step_sg };
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
1899 $("#mashGrid").jqxGrid('updaterow', r1, obj2);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1900 $("#mashGrid").jqxGrid('updaterow', r2, obj1);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1901 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1902
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1903 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
1904 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
1905 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
1906 //console.log('b - a: ' + (b - a) + ' t: ' + ((infuse_temp - step_temp) * 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
1907 //console.log('res: ' + ((b - a) / ((infuse_temp - step_temp) * 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
1908 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
1909 console.log('infusionVol(' + step_infused + ', ' + step_mashkg + ', ' + infuse_temp + ', ' + step_temp + ', ' + last_temp + '): ' + vol);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1910 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
1911 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1912
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1913 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
1914 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
1915 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
1916 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
1917 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
1918 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
1919 console.log('decoctionVol(' + step_volume + ', ' + step_temp + ', ' + prev_temp + '): ' + vol);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1920 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
1921 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1922
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
1923 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
1924 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
1925 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
1926 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
1927 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
1928 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
1929 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
1930 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
1931 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
1932 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
1933 max = 97;
623
4aee10bcb94e Better yeast viability for PurePitch yeast.
Michiel Broek <mbroek@mbse.eu>
parents: 622
diff changeset
1934 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
1935 vpm = 0.95;
623
4aee10bcb94e Better yeast viability for PurePitch yeast.
Michiel Broek <mbroek@mbse.eu>
parents: 622
diff changeset
1936 max = 100;
4aee10bcb94e Better yeast viability for PurePitch yeast.
Michiel Broek <mbroek@mbse.eu>
parents: 622
diff changeset
1937 }
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
1938 } else if (row.y_form == 1) { // dry yeast
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1939 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
1940 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
1941 } 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
1942 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
1943 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
1944 } 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
1945 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
1946 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
1947 }
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
1948 }
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
1949 }
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
1950 }
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
1951 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
1952 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
1953
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
1954 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
1955 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
1956 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
1957 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
1958 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
1959 // 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
1960 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
1961 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
1962 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
1963 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
1964
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
1965 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
1966 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
1967 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
1968 }
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
1969 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
1970 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
1971 }
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
1972 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
1973 }
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
1974 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
1975
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
1976 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
1977 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
1978 $('#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
1979 }
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
1980 }
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
1981
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1982 function calcSupplies() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1983 if (dataRecord.inventory_reduced > 6) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1984 $('#ok_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1985 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1986 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1987 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
1988 $('#ok_supplies').html("<img src='images/dialog-ok-apply.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1989 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1990 $('#ok_supplies').html("<img src='images/dialog-error.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1991 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1992
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1993 function calcPercentages() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1994
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1995 console.log('calcPercentages()');
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1996 var tw = 0, rowdata, percentage, rowscount = dataRecord.fermentables.length;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1997 if (rowscount > 1) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1998 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
1999 rowdata = dataRecord.fermentables[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2000 if (rowdata.f_added < 4)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2001 tw += Round(rowdata.f_amount, 3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2002 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2003 tw = Round(tw, 3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2004
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2005 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2006 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2007 if (rowdata.f_added < 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2008 percentage = Round(rowdata.f_amount / tw * 100, 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2009 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', percentage);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2010 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2011 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2012 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2013 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2014 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2015 $('#fermentableGrid').jqxGrid('setcellvalue', 0, 'f_percentage', 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2016 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2017 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2018
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2019 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2020 * All calculations that depend on changes in the fermentables,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2021 * volumes and equipments.
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 function calcFermentables() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2024
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2025 var sugarsf = 0, // fermentable sugars mash + boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2026 sugarsm = 0, // fermentable sugars in mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2027 vol = 0, // Volume sugars after boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2028 addedS = 0, // Added sugars after boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2029 addedmass = 0, // Added mass after boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2030 mvol = 0, // mash volume
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2031 colort = 0, // Colors srm * vol totals
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2032 colorh = 0, // Colors ebc * vol * kt
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2033 colorn = 0, // Colors ebc * pt * pct
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2034 my_100 = false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2035 mashtime = 0, // Total mash time
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2036 mashtemp = 0, // Average mash temperature
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2037 bv = 0.925, // Bierverlies rendement
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2038 sr = 0.95, // Mash en spoel rendement
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2039 lintner = 0, // Total recipe lintner
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2040 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
2041 sug, alc, pt, cw, color, scolor, fig;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2042
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2043 /* Init global variables */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2044 psugar = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2045 pcara = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2046 mashkg = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2047 ok_fermentables = 1; // All is in stock.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2048 ok_yeasts = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2049
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2050 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
2051 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
2052 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
2053 if (parseFloat(row.step_type) == 0) // Infusion
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2054 mvol += parseFloat(row.step_infuse_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2055 if (row.step_temp <= 75) { // Ignore mashout
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2056 timem = row.step_time + row.ramp_time;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2057 mashtime += timem;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2058 mashtemp += timem * row.step_temp;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2059 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2060 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2061 if (mashtime > 5)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2062 mashtime -= 5; //Correct last ramp > 75
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2063 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
2064 } 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
2065 console.log("calcFermentables() no mash steps");
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2066 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2067
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2068 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
2069 console.log("calcFermentables() no fermentables");
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2070 return; // grid not yet loaded.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2071 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2072
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 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
2074 row = dataRecord.fermentables[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2075 if (row.f_adjust_to_total_100)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2076 my_100 = true;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2077 if (row.f_type == 1 && row.f_added < 4) // Sugar
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2078 psugar += row.f_percentage;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2079 if (row.f_graintype == 2 && row.f_added < 4) // Crystal
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2080 pcara += row.f_percentage;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2081 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
2082 if (row.f_added == 0) { // Mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2083 if (mvol > 0) { // Only if mash already known.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2084 mvol += row.f_amount * row.f_moisture / 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2085 s += d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2086 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2087 d = parseFloat(dataRecord.efficiency) / 100 * d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2088 sugarsm += d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2089 mashkg += parseFloat(row.f_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2090 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2091 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
2092 sugarsf += d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2093 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
2094 x = (row.f_yield / 100) * (1 - row.f_moisture / 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2095 addedS += row.f_amount * x;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2096 addedmass += row.f_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2097 vol += (x * sugardensity + (1 - x) * 1) * row.f_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2098 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2099 if (row.f_added < 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2100 colort += row.f_amount * ebc_to_srm(row.f_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2101 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
2102 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
2103 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2104 if (fermentableInit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2105 if (row.f_added == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2106 $('#bottle_priming_total').val(row.f_amount * 1000); // Prevent clearing
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2107 $('#bottle_priming_sugar').jqxDropDownList('selectItem', row.f_name);
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 if (row.f_added == 5) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2110 $('#keg_priming_total').val(row.f_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2111 $('#keg_priming_sugar').jqxDropDownList('selectItem', row.f_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2112 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2113 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2114 // Check supplies.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2115 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
2116 ((dataRecord.inventory_reduced <= 3) && (row.f_added == 2)) || // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2117 ((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
2118 ((dataRecord.inventory_reduced <= 6) && (row.f_added == 4)) || // Bottle
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2119 ((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
2120 ok_fermentables = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2121 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2122 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
2123 lintner += row.f_diastatic_power * row.f_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2124 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2125 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2126 fermentableInit = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2127 $('#ferm_lintner').val(Math.round(parseFloat(lintner / mashkg)));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2128 $('#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
2129 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
2130 to_100 = my_100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2131 if (to_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2132 $('#wf_amount').jqxNumberInput({ width: 90, readOnly: true, spinButtons: false });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2133 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2134 $('#wf_amount').jqxNumberInput({ width: 110, readOnly: false, spinButtons: true });
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 if (mvol > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2138 v = s / sugardensity + mvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2139 s = 1000 * s / (v * 10); //deg. Plato
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2140 est_mash_sg = Round(plato_to_sg(s), 5);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2141 $('#est_mash_sg').val(est_mash_sg);
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 // Estimate total recipe OG.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2145 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
2146 $('#est_og').val(dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2147 $('#est_og2').val(dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2148 org = dataRecord.est_og;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2149
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2150 // Estimate SG in kettle after boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2151 aboil_sg = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2152 $('#est_og3').val(aboil_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2153
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2154 // Estimate SG in kettle before boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2155 preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2156 $('#est_pre_sg').val(preboil_sg);
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 // Recalculate volumes.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2159 aboil_volume = parseFloat(dataRecord.batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2160 if (dataRecord.brew_aboil_volume > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2161 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
2162 if (dataRecord.brew_fermenter_tcloss == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2163 dataRecord.brew_fermenter_tcloss = dataRecord.eq_trub_chiller_loss;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2164 $('#brew_fermenter_tcloss').val(dataRecord.brew_fermenter_tcloss);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2165 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2166 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
2167 $('#brew_fermenter_volume').val(dataRecord.brew_fermenter_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2168 // Estimated needed sparge water corrected for the temperature.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2169 spoelw = (dataRecord.boil_size - mash_infuse + (mashkg * my_grain_absorbtion) + dataRecord.eq_lauter_deadspace) * 1.03;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2170 $('#brew_sparge_est').val(spoelw);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2171 // Calculate SG in fermenter
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2172 ogx = dataRecord.brew_aboil_sg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2173 if (ogx < 1.002)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2174 ogx = aboil_sg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2175 topw = dataRecord.brew_fermenter_extrawater;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2176
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2177 if (dataRecord.brew_fermenter_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2178 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
2179 sug += addedS; //kg
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2180
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2181 if ((dataRecord.brew_fermenter_volume * ogx + addedmass) > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2182 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
2183 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
2184 $('#brew_fermenter_sg').val(dataRecord.brew_fermenter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2185 // color
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2186 if (dataRecord.color_method == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2187 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
2188 } else if (dataRecord.color_method == 3) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2189 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
2190 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2191 cw = colort / (aboil_volume + topw) * 8.34436;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2192 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
2193 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2194 $('#brew_fermenter_color').val(dataRecord.brew_fermenter_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2195 scolor = ebc_to_color(dataRecord.brew_fermenter_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2196 $('#bcolorf').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2197 document.getElementById('bcolorf').style.background = scolor;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2198 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2199 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2200 // Negative volume
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2201 dataRecord.brew_fermenter_sg = dataRecord.brew_fermenter_color = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2202 $('#brew_fermenter_sg').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2203 $('#brew_fermenter_color').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2204 $('#bcolorf').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2205 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2206
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2207 // Color of the wort
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2208 if (dataRecord.color_method == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2209 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
2210 } else if (dataRecord.color_method == 3) { // Hans Halberstadt
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2211 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
2212 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2213 cw = colort / parseFloat(dataRecord.batch_size) * 8.34436;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2214 color = kw_to_ebc(dataRecord.color_method, cw);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2215 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2216 dataRecord.est_color = color;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2217 $('#est_color').val(color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2218 $('#est_color2').val(color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2219 scolor = ebc_to_color(color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2220 document.getElementById('bcolor').style.background = scolor;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2221 document.getElementById('bcolor2').style.background = scolor;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2222
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2223 // Progress bars
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2224 pmalts = mashkg / dataRecord.eq_mash_max * 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2225 $('#perc_malts').jqxProgressBar('val', pmalts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2226 $('#perc_sugars').jqxProgressBar('val', psugar);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2227 $('#perc_cara').jqxProgressBar('val', pcara);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2228 calcStage();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2229
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2230 // Calculate estimated svg.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2231 svg = 0; // default.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2232 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
2233 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
2234 row = dataRecord.yeasts[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2235 if (row.y_use == 0) { // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2236 if (parseFloat(row.y_attenuation) > svg)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2237 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
2238 if (row.y_form == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2239 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
2240 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
2241 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
2242 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2243 // TODO: brett in secondary ??
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2244 if ((((dataRecord.inventory_reduced <= 3) && (row.y_use == 0)) || // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2245 ((dataRecord.inventory_reduced <= 4) && (row.y_use == 1)) || // Secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2246 ((dataRecord.inventory_reduced <= 5) && (row.y_use == 2)) || // Tertiary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2247 ((dataRecord.inventory_reduced <= 6) && (row.y_use == 3))) && // Bottle
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2248 (row.y_inventory < row.y_amount)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2249 ok_yeasts = 0;
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 calcSupplies();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2253 if (svg == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2254 svg = 77;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2255
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2256 if ((mashkg > 0) && (mash_infuse > 0) && (mashtime > 0) && (mashtemp > 0)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2257 dataRecord.est_fg = estimate_fg(psugar, pcara, mash_infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2258 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2259 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
2260 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2261 $('#est_fg').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2262 $('#est_fg2').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2263 $('#est_fg3').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2264 fig = dataRecord.est_fg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2265
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2266 dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2267 $('#est_abv').val(dataRecord.est_abv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2268 $('#est_abv2').val(dataRecord.est_abv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2269
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2270 // Calculate the final svg if available use the real value.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2271 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
2272 svg = calc_svg(dataRecord.brew_fermenter_sg, dataRecord.fg);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2273 org = dataRecord.brew_fermenter_sg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2274 fig = dataRecord.fg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2275 }
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 $('#yeast_cells').val(initcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2278 $('#need_cells').val(getNeededYeastCells());
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 // Calculate the calories in kcal/l (from brouwhulp)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2281 alc = 1881.22 * fig * (org - fig) / (1.775 - org);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2282 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
2283 $('#kcal').val(Math.round((alc + sug) / (12 * 0.0295735296)));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2284 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2285
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2286 function calcMash() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2287
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
2288 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
2289 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
2290 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
2291 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
2292
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2293 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
2294 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
2295 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
2296 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
2297 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
2298 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
2299 // 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
2300 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
2301 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
2302 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
2303 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
2304 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
2305 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
2306 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
2307 } 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
2308 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
2309 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2310 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
2311 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
2312 }
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2313 //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
2314 } 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
2315 // 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
2316 row.step_infuse_amount = infusionVol(infused, mashkg, row.step_infuse_temp, row.step_temp, lasttemp);
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2317 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
2318 }
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
2319 infused += 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
2320 } 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
2321 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
2322 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
2323 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
2324 } 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
2325 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
2326 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
2327 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
2328 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
2329 //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
2330 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
2331 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
2332 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
2333 $('#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
2334 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2335 }
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
2336 mashvol = mashkg * MaltVolume + infused;
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
2337 $('#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
2338 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
2339 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
2340 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
2341 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
2342 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
2343 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
2344 $('#est_mashtime').val(h + ':' + m);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2345 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2346
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2347 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2348 * Change OG of recipe but keep the water volumes.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2349 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2350 function calcFermentablesFromOG(OG) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2351
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2352 console.log('calcFermentablesFromOG(' + OG + ')');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2353 var amount, row, d, i, sug, tot = 0, totmass = 0, rowscount, efficiency = parseFloat($('#efficiency').jqxNumberInput('decimal'));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2354 sug = sg_to_plato(OG) * parseFloat($('#batch_size').jqxNumberInput('decimal')) * OG / 100; //total amount of sugars in kg
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2355 rowscount = dataRecord.fermentables.length;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2356
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2357 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
2358 row = dataRecord.fermentables[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2359 if (row.f_added < 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2360 d = row.f_percentage / 100 * (row.f_yield / 100) * (1 - row.f_moisture / 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2361 if (row.f_added == 0) // Mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2362 d = efficiency / 100 * d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2363 tot += d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2364 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2365 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2366 if (tot)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2367 totmass = Round(sug / tot, 3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2368
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2369 if (totmass) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2370 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
2371 row = dataRecord.fermentables[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2372 if (row.f_added < 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2373 amount = Math.round(row.f_percentage * 10 * totmass) / 1000;
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2374 dataRecord.fermentables[i].f_amount = amount;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2375 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2376 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2377 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2378 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2379 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2380
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2381 function getNeededYeastCells() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2382
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2383 var plato, volume, sg = dataRecord.brew_fermenter_sg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2384 if (sg <= 1.0001 && dataRecord.fg > 1.000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2385 sg = dataRecord.fg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2386 else if (sg <= 1.0001)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2387 sg = dataRecord.est_og;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2388 plato = sg_to_plato(sg);
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 volume = dataRecord.brew_fermenter_volume;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2391 if (volume <= 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2392 volume = dataRecord.batch_size - dataRecord.eq_trub_chiller_loss;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2393
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
2394 return dataRecord.yeast_pitchrate * volume * plato;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2395 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2396
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2397 function hopFlavourContribution(bt, vol, use, amount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2398 var result;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2399
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2400 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
2401 return 0;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2402 if (use == 1) { // First wort
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2403 result = 0.15; // assume 15% flavourcontribution for fwh
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2404 } else if (bt > 50) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2405 result = 0.10; // assume 10% flavourcontribution as a minimum
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2406 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2407 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
2408 if (result < 0.10)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2409 result = 0.10; // assume 10% flavourcontribution as a minimum
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2410 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2411 return (result * amount * 1000) / vol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2412 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2413
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2414 function hopAromaContribution(bt, vol, use, amount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2415 var result = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2416
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2417 if (use == 5) { // Dry hop
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2418 result = 1.33;
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2419 } else if (use == 4) { // Whirlpool
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2420 if (bt > 30)
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2421 bt = 30; // Max 30 minutes
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2422 result = 0.62 * bt / 30;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2423 } else if (bt > 20) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2424 result = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2425 } else if (bt > 7.5) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2426 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
2427 } else if (use == 2) { // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2428 result = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2429 } else if (use == 3) { // Aroma
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2430 result = 1.2;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2431 }
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2432 return (result * amount * 1000) / vol;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2433 }
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 function calcIBUs() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2436 var total_ibus = 0, ferm_ibus = 0, rows = {}, i, row;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2437 hop_aroma = hop_flavour = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2438 if (!(rows = $('#hopGrid').jqxGrid('getrows'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2439 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2440 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2441 ok_hops = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2442 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2443 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2444 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
2445 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
2446 dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2447 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
2448 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
2449 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
2450 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
2451 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
2452 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
2453 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
2454 ((dataRecord.inventory_reduced <= 6) && (row.h_useat == 5))) && // Dry-hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2455 (row.h_inventory < row.h_amount))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2456 ok_hops = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2457 }
557
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2458 total_ibus = Round(total_ibus, 1);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2459 ferm_ibus = Round(ferm_ibus, 1);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2460 hop_flavour = Round(hop_flavour * 100 / 5, 1);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2461 hop_aroma = Round(hop_aroma * 100 / 6, 1);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2462 if (hop_flavour > 100)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2463 hop_flavour = 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2464 if (hop_aroma > 100)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2465 hop_aroma = 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2466 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
2467 ' fermenter:' + ferm_ibus + ' supplies:' + ok_hops);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2468 dataRecord.est_ibu = total_ibus;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2469 $('#est_ibu').val(total_ibus);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2470 $('#est_ibu2').val(total_ibus);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2471 $('#hop_flavour').jqxProgressBar('val', hop_flavour);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2472 $('#hop_aroma').jqxProgressBar('val', hop_aroma);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2473 $('#brew_fermenter_ibu').val(ferm_ibus);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2474 calcStage();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2475 calcSupplies();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2476 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2477
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2478 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2479 * 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
2480 *
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2481 * stype: 0=stirred, 1=shaken, 2=simple
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2482 * totcells: initial cells
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2483 * egrams: gram extract
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2484 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2485 function getGrowthRate(stype, totcells, egrams) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2486
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2487 /* Cells per grams extract (B/g) */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2488 var cpe = totcells / egrams;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2489
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2490 if (cpe > 3.5)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2491 return 0; // no growth
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2492 if (stype == 2)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2493 return 0.4; // simple starter
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2494 if (stype == 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2495 return 0.62; // shaken starter
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2496 if (cpe <= 1.4) // stirred starter
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2497 return 1.4;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2498 return 2.33 - (.67 * cpe);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2499 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2500
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2501 function calcStep(svol, stype, start) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2502
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2503 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
2504 prate = start / svol * 1000,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2505 irate = Round(prate, 1),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2506 egrams = (dataRecord.starter_sg - 1) * svol * gperpoint,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2507 grate = getGrowthRate(stype, start, egrams),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2508 ncells = Round(egrams * grate, 1),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2509 totcells = parseFloat(ncells) + start;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2510
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2511 return {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2512 svol: svol,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2513 irate: irate,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2514 prate: Round(prate, 1),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2515 ncells: ncells,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2516 totcells: totcells,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2517 growf: Round(ncells / start, 2)
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 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2520
649
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2521 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
2522
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2523 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
2524 $('#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
2525 $('#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
2526 $('#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
2527 $('#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
2528 }
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2529
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2530 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
2531
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2532 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
2533 $('#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
2534 $('#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
2535 $('#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
2536 $('#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
2537 }
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2538
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2539 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
2540
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2541 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
2542 $('#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
2543 $('#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
2544 $('#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
2545 $('#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
2546 }
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2547
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2548 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2549 * Calculate all starter steps.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2550 * stype: final starter type: 0 = stirred, 1 = shaked, 2 = simple.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2551 * start: initial cells in billions
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2552 * needed: needed cells in billions
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2553 *
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2554 * result: all values updated.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2555 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2556 function calcSteps(stype, start, needed) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2557
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2558 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
2559 mvols = uvols.length, svol = 0, lasti = 0, result = {}, i;
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 * If no values are set, auto calculate the starter.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2563 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2564 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
2565 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
2566 // clear by default
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2567 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
2568 $('#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
2569 $('#r' + i + '_pmpt').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2570 $('#prop' + i + '_type').val(stype);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2571 $('#prop' + i + '_volume').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2572 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2573 if (start > needed) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2574 return; // no starter needed
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2575 }
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2576 $('#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
2577 $('#r1_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2578 for (i = lasti; i <= mvols; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2579 lasti = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2580 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2581 result = calcStep(svol, stype, start);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2582 if (result.irate < 25) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2583 // inocculation rate too low, backup one step and break out.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2584 lasti = i - 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2585 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2586 result = calcStep(svol, stype, start);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2587 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2588 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2589 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
2590 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2591 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2592 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2593 $('#prop1_volume').val(result.svol / 1000); // to liters
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2594 $('#prop1_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2595 $('#prop1_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2596 $('#prop1_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2597 $('#prop1_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2598 if (result.totcells > needed)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2599 return; // hit the target
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2600
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2601 // second stage
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2602 $('#r2_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2603 $('#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
2604 $('#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
2605 for (i = lasti; i <= mvols; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2606 lasti = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2607 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2608 result = calcStep(svol, stype, $('#prop1_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2609 if (result.irate < 25) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2610 lasti = i - 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2611 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2612 result = calcStep(svol, stype, $('#prop1_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2613 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2614 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2615 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
2616 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2617 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2618 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2619 $('#prop2_volume').val(result.svol / 1000); // to liters
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2620 $('#prop2_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2621 $('#prop2_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2622 $('#prop2_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2623 $('#prop2_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2624 if (result.totcells > needed)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2625 return; // hit the target
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2626
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2627 // third stage
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2628 $('#r3_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2629 $('#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
2630 $('#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
2631 for (i = lasti; i <= mvols; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2632 lasti = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2633 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2634 result = calcStep(svol, stype, $('#prop2_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2635 if (result.irate < 25) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2636 lasti = i - 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2637 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2638 result = calcStep(svol, stype, $('#prop2_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2639 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2640 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2641 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
2642 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2643 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2644 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2645 $('#prop3_volume').val(result.svol / 1000); // to liters
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2646 $('#prop3_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2647 $('#prop3_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2648 $('#prop3_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2649 $('#prop3_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2650 if (result.totcells > needed)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2651 return; // hit the target
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2652
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2653 // fourth stage
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2654 $('#r4_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2655 $('#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
2656 $('#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
2657 for (i = lasti; i <= mvols; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2658 lasti = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2659 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2660 result = calcStep(svol, stype, $('#prop3_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2661 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
2662 $('#prop4_volume').val(result.svol / 1000); // to liters
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2663 $('#prop4_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2664 $('#prop4_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2665 $('#prop4_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2666 $('#prop4_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2667 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2668 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2669 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2670 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2671 // recalculate
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2672 if (dataRecord.prop1_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2673 $('#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
2674 $('#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
2675 result = calcStep($('#prop1_volume').val() * 1000, dataRecord.prop1_type, start);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2676 $('#prop1_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2677 $('#prop1_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2678 $('#prop1_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2679 $('#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
2680 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
2681 killstep2();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2682 killstep3();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2683 killstep4();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2684 } 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
2685 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
2686 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
2687 $('#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
2688 $('#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
2689 }
478
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 if (dataRecord.prop2_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2692 $('#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
2693 $('#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
2694 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
2695 $('#prop2_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2696 $('#prop2_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2697 $('#prop2_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2698 $('#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
2699 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
2700 killstep3();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2701 killstep4();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2702 } 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
2703 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
2704 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
2705 $('#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
2706 $('#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
2707 }
478
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 if (dataRecord.prop3_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2710 $('#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
2711 $('#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
2712 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
2713 $('#prop3_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2714 $('#prop3_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2715 $('#prop3_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2716 $('#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
2717 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
2718 killstep4();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
2719 } 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
2720 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
2721 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
2722 $('#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
2723 $('#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
2724 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2725 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2726 if (dataRecord.prop4_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2727 $('#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
2728 $('#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
2729 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
2730 $('#prop4_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2731 $('#prop4_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2732 $('#prop4_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2733 $('#prop4_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2734 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2735 }
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 calcYeast() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2739
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2740 // Calculate needed cells.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2741 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
2742
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2743 if (sg <= 1.0001 && dataRecord.fg > 1.000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2744 sg = dataRecord.fg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2745 else if (sg <= 1.0001)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2746 sg = dataRecord.est_og;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2747 plato = sg_to_plato(sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2748
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2749 volume = dataRecord.brew_fermenter_volume;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2750 if (volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2751 if (dataRecord.brew_fermenter_extrawater > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2752 volume += dataRecord.brew_fermenter_extrawater;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2753 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2754 volume = dataRecord.batch_size - dataRecord.eq_trub_chiller_loss;
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
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2757 // Also in calcFermentables()
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2758 $('#yeast_cells').val(initcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2759
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2760 if (!(rows = $('#yeastGrid').jqxGrid('getrows'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2761 return; // grid not yet loaded.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2762 }
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2763 rowscount = dataRecord.yeasts.length;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2764 if (rowscount == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2765 return; // no yeast in recipe
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2766
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2767 $('.primary_dry').hide();
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2768 $('.primary_liquid').hide();
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2769
620
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2770 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
2771 var pitchrate = 0.75; // Yeast pitch rate default
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2772 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
2773 row = dataRecord.yeasts[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2774 if (row.y_use == 0) { // primary
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2775 if (row.y_form == 1) {
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2776 // Dry yeast
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2777 $('.primary_dry').show();
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2778 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
2779 // Build the formule with the yeast parameters.
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2780 // 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
2781 var og = row.y_sg_lo;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2782 var f1 = row.y_gr_hl_lo / 100;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2783 var f2 = Round(f1 / 5, 6);
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2784 // 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
2785 // 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
2786 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
2787 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
2788 // dataRecord.starter_viability
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2789 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
2790 $('#yeast_grams').val(yeast_grams);
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2791 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
2792 $('#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
2793 //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
2794
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
2795 } else {
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2796 // Liquid yeast
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2797 $('.primary_liquid').show();
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2798 // 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
2799 // 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
2800 if (row.y_type == 0) { // lager yeast
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2801 pitchrate = 1.5;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2802 if (dataRecord.est_og > 1.060)
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2803 pitchrate = 2.0;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2804 } else if (row.y_type == 6) { // Kveik
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2805 pitchrate = 0.075;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2806 } else {
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2807 pitchrate = 0.75;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2808 if (dataRecord.est_og > 1.060)
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2809 pitchrate = 1.0;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2810 }
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2811 if (dataRecord.yeast_pitchrate < 0.01) {
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2812 dataRecord.yeast_pitchrate = pitchrate;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2813 $('#yeast_pitchrate').val(pitchrate);
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2814 }
620
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2815 maybe_starter = 1;
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2816 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2817 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2818 }
620
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2819
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
2820 needed = Round(dataRecord.yeast_pitchrate * volume * plato, 1);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2821 $('#need_cells').val(needed);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2822 use_cells = initcells;
620
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2823 if (needed <= initcells)
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2824 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
2825 //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
2826
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2827 if (maybe_starter != dataRecord.starter_enable) {
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2828 dataRecord.starter_enable = maybe_starter;
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
2829 showStarter();
620
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2830 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2831
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2832 if (dataRecord.starter_enable) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2833 calcSteps(dataRecord.starter_type, initcells, needed);
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 for (i = 1; i < 5; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2836 $('#r' + i + '_irate').html('');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2837 $('#r' + i + '_growf').html('');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2838 $('#r' + i + '_tcells').html('');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2839 if (parseFloat($('#prop' + i + '_volume').val()) > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2840 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
2841 $('#r' + i + '_irate').html("<img src='images/dialog-error.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2842 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2843 $('#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
2844 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2845 if (parseFloat($('#prop' + i + '_growf').val()) < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2846 $('#r' + i + '_growf').html("<img src='images/dialog-error.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2847 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
2848 $('#r' + i + '_growf').html("<img src='images/dialog-error.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2849 if (parseFloat($('#prop' + i + '_tcells').val()) > needed)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2850 $('#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
2851 use_cells = parseFloat($('#prop' + i + '_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2852 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2853 $('#r' + i + '_irate').html('');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2854 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2855 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2856 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2857 $('#plato_cells').val(parseFloat(use_cells / (volume * plato)));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2858 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2859
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2860 function adjustHops(factor) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2861
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2862 //console.log('adjustHops(' + factor + ')');
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2863 var row, i, amount, rowscount = dataRecord.hops.length;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2864 if (rowscount == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2865 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2866 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
2867 row = dataRecord.hops[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2868 amount = row.h_amount * factor;
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2869 dataRecord.hops[i].h_amount = amount;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2870 $('#hopGrid').jqxGrid('setcellvalue', i, 'h_amount', amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2871 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2872 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2873
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2874 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
2875 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
2876 if (rowscount == 0)
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2877 return;
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2878 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
2879 row = dataRecord.hops[i];
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2880 if (row.h_useat == 4) {
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2881 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
2882 dataRecord.hops[i].h_time = time;
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2883 $('#hopGrid').jqxGrid('setcellvalue', i, 'h_time', time);
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2884 }
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2885 }
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2886 };
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2887
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2888 function calcMiscs() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2889
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2890 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
2891 var row, i, rowscount = dataRecord.miscs.length;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2892 if (rowscount == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2893 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2894 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
2895 row = dataRecord.miscs[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2896 if ((((dataRecord.inventory_reduced <= 2) && (row.m_use_use <= 2)) || // Starter, Mash, Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2897 ((dataRecord.inventory_reduced <= 3) && (row.m_use_use == 3)) || // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2898 ((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
2899 ((dataRecord.inventory_reduced <= 6) && (row.m_use_use == 5))) && // Bottle
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2900 (row.m_inventory < row.m_amount)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2901 ok_miscs = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2902 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2903 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2904 calcSupplies();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2905 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2906
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2907 function adjustMiscs(factor) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2908
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2909 //console.log('adjustMiscs(' + factor + ')');
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2910 var row, i, amount, rowscount = dataRecord.miscs.length;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2911 if (rowscount == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2912 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2913 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
2914 row = dataRecord.miscs[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2915 amount = row.m_amount * factor;
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2916 dataRecord.miscs[i].m_amount = amount;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2917 $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2918 switch (row.m_name) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2919 case 'CaCl2':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2920 $('#wa_cacl2').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2921 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2922 case 'CaSO4':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2923 $('#wa_caso4').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2924 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2925 case 'MgSO4':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2926 $('#wa_mgso4').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2927 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2928 case 'NaCl':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2929 $('#wa_nacl').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2930 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2931 case 'Melkzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2932 case 'Zoutzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2933 case 'Fosforzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2934 case 'Zwavelzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2935 $('#wa_acid').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2936 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2937 case 'NaHCO3':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2938 case 'Na2CO3':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2939 case 'CaCO3':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2940 case 'Ca(OH)2':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2941 $('#wa_base').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2942 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2943 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2944 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2945 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2946
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2947 function adjustYeasts(factor) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2948
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2949 //console.log('adjustYeasts(' + factor + ')');
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2950 var row, i, amount, rowscount = dataRecord.yeasts.length;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2951 if (rowscount == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2952 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2953 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
2954 row = dataRecord.yeasts[i];
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
2955 if (! dataRecord.starter_enable) { // Only adjust without a starter
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2956 amount = row.y_amount * factor;
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2957 dataRecord.yeasts[i].y_amount = amount;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2958 $('#yeastGrid').jqxGrid('setcellvalue', i, 'y_amount', amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2959 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2960 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2961 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2962 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2963
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2964 function adjustWaters(factor) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2965
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2966 //console.log('adjustWaters(' + factor + ')');
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2967 var amount, row, i, rowscount = dataRecord.mashs.length;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2968 if (rowscount == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2969 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2970 mash_infuse = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2971 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
2972 row = dataRecord.mashs[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2973 if (row.step_type == 0) { // Infusion
612
576128de01e3 Fixed mash infuse amount division
Michiel Broek <mbroek@mbse.eu>
parents: 610
diff changeset
2974 amount = Round(parseFloat(row.step_infuse_amount) * factor, 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
2975 dataRecord.mashs[i].step_infuse_amount = amount;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2976 $('#mashGrid').jqxGrid('setcellvalue', i, 'step_infuse_amount', amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2977 mash_infuse += amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2978 }
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 if (dataRecord.w2_amount == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2981 dataRecord.w1_amount = mash_infuse;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2982 $('#w1_amount').val(mash_infuse);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2983 } else {
612
576128de01e3 Fixed mash infuse amount division
Michiel Broek <mbroek@mbse.eu>
parents: 610
diff changeset
2984 var w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
576128de01e3 Fixed mash infuse amount division
Michiel Broek <mbroek@mbse.eu>
parents: 610
diff changeset
2985 var w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
576128de01e3 Fixed mash infuse amount division
Michiel Broek <mbroek@mbse.eu>
parents: 610
diff changeset
2986 dataRecord.w1_amount = Round(w1_amount, 3);
576128de01e3 Fixed mash infuse amount division
Michiel Broek <mbroek@mbse.eu>
parents: 610
diff changeset
2987 dataRecord.w2_amount = Round(w2_amount, 3);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2988 $('#w1_amount').val(dataRecord.w1_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2989 $('#w2_amount').val(dataRecord.w2_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2990 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2991 $('#wg_amount').val(mash_infuse);
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 function calcMashEfficiency() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2995 var c, m;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2996 if (parseFloat($('#brew_mash_sg').jqxNumberInput('decimal')) < 1.002)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2997 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2998 c = sg_to_plato(est_mash_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2999 m = sg_to_plato(parseFloat($('#brew_mash_sg').jqxNumberInput('decimal')));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3000 if (c > 0.5)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3001 $('#brew_mash_efficiency').val(100 * m / c);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3002 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3003 $('#brew_mash_efficiency').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3004 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3005
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3006 function calcEfficiencyBeforeBoil() {
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
3007 var m = 0, i, row, tot, result = 0;
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
3008 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
3009 return; // no grid loaded yet
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
3010 if (dataRecord.fermentables.length == 0)
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
3011 return; // no fermentables
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
3012 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
3013 row = dataRecord.fermentables[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3014 if (row.f_added == 0) { // Mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3015 m += 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
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 tot = sg_to_plato(dataRecord.brew_preboil_sg) * (dataRecord.brew_preboil_volume / 1.04) * dataRecord.brew_preboil_sg * 10 / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3019 if (m > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3020 result = Round((tot / m * 100), 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3021 if (result < 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3022 result = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3023 $('#brew_preboil_efficiency').val(result);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3024 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3025
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3026 function calcEfficiencyAfterBoil() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3027 var m = 0, // Sugars added at mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3028 b = 0, // Sugars added at boil
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
3029 i, row, tot, result = 0;
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
3030 if (!($('#fermentableGrid').jqxGrid('getrows'))) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3031 return; // grid not yet loaded.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3032 }
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
3033 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
3034 row = dataRecord.fermentables[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3035 if (row.f_added == 0) { // Mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3036 m += 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
3037 } else if (row.f_added == 1) { // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3038 b += 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
3039 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3040 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3041 tot = sg_to_plato(dataRecord.brew_aboil_sg) * (dataRecord.brew_aboil_volume / 1.04) * dataRecord.brew_aboil_sg * 10 / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3042 tot -= b; // total sugars in wort minus added sugars.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3043 if (m > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3044 result = Round((tot / m * 100), 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3045 if (result < 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3046 result = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3047 dataRecord.brew_aboil_efficiency = result;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3048 $('#brew_aboil_efficiency').val(result);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3049 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3050
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3051 function GetBUGU() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3052 var gu = (dataRecord.est_og - 1) * 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3053 if (gu > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3054 return dataRecord.est_ibu / gu;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3055 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3056 return 0.5;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3057 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3058
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
3059 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
3060 if (parseFloat($('#pr_sulfate').jqxNumberInput('decimal')) > 0 && parseFloat($('#pr_chloride').jqxNumberInput('decimal'))) {
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
3061 return (parseFloat($('#pr_sulfate').jqxNumberInput('decimal')) / parseFloat($('#pr_chloride').jqxNumberInput('decimal')));
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
3062 } 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
3063 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
3064 return (1.0 / (-1.2 * BUGU + 1.4));
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
3065 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3066 }
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 function setWaterAgent(name, amount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3069 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
3070 if (amount == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3071 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3072 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3073 if (row.m_name == name) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3074 id = $('#miscGrid').jqxGrid('getrowid', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3075 $('#miscGrid').jqxGrid('deleterow', id);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3076 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3077 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3078 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3079 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3080 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3081 if (row.m_name == name) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3082 found = true;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3083 $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount / 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3084 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3085 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3086 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3087 if (! found) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3088 miscs = new $.jqx.dataAdapter(miscInvSource, {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3089 loadComplete: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3090 var record, i, row = {}, records = miscs.records;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3091 for (i = 0; i < records.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3092 record = records[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3093 if (record.name == name) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3094 row['m_name'] = record.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3095 row['m_amount'] = amount / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3096 row['m_cost'] = record.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3097 row['m_type'] = record.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3098 row['m_use_use'] = record.use_use;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3099 row['m_time'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3100 row['m_amount_is_weight'] = record.amount_is_weight;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3101 row['m_inventory'] = record.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3102 row['m_avail'] = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3103 $('#miscGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3104 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3105 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3106 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3107 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3108 miscs.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3109 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3110 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3111 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3112 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3113
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3114 function setRangeIndicator(ion, rangeCode) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3115 if ((rangeCode == 'laag') || (rangeCode == 'hoog'))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3116 $('#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
3117 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3118 $('#wr_' + ion).html("<img src='images/dialog-ok-apply.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3119 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3120
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3121 function mix(v1, v2, c1, c2) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3122 if ((v1 + v2) > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3123 return ((v1 * c1) + (v2 * c2)) / (v1 + v2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3124 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3125 return 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3126 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3127
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3128 function PartCO3(pH) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3129 var H = Math.pow(10, -pH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3130 return 100 * Ka1 * Ka2 / (H * H + H * Ka1 + Ka1 * Ka2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3131 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3132
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3133 function PartHCO3(pH) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3134 var H = Math.pow(10, -pH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3135 return 100 * Ka1 * H / (H * H + H * Ka1 + Ka1 * Ka2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3136 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3137
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3138 function Charge(pH) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3139 return (-2 * PartCO3(pH) - PartHCO3(pH));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3140 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3141
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3142 //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
3143 function ZAlkalinity(pHZ) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3144 var C43 = Charge(4.3),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3145 Cw = Charge(parseFloat($('#wg_ph').jqxNumberInput('decimal'))),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3146 Cz = Charge(pHZ),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3147 DeltaCNaught = -C43 + Cw,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3148 CT = parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')) / 50 / DeltaCNaught,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3149 DeltaCZ = -Cz + Cw;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3150 return CT * DeltaCZ;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3151 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3152
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3153 //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
3154 function ZRA(pHZ) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3155
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3156 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
3157 Magn = parseFloat($('#wg_magnesium').jqxNumberInput('decimal')) / (MMMg / 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3158 Z = ZAlkalinity(pHZ);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3159 return Z - (Calc / 3.5 + Magn / 7);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3160 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3161
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
3162 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
3163 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
3164 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
3165 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
3166 } 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
3167 // 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
3168 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
3169 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
3170 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
3171 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
3172 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
3173 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
3174 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
3175 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
3176 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
3177 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
3178 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
3179 }
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
3180 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3181 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
3182 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3183
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3184 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
3185
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
3186 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
3187 // 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
3188 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
3189 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
3190 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
3191 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
3192 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
3193 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
3194 Result += x * row.f_amount;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3195 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3196 }
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
3197 } 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
3198 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
3199 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
3200 console.log('ProtonDeficit(' + pHZ + ') invalid grist, return ' + Result);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3201 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3202 return Result;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3203 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3204
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3205 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
3206
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3207 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
3208 while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3209 n++;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3210 if (pd < -deltapd)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3211 pH -= deltapH;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3212 else if (pd > deltapd)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3213 pH += deltapH;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3214 pd = ProtonDeficit(pH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3215 }
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
3216 pH = Round(pH, 6);
644
4654b8ee4690 Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
3217 //console.log('MashpH() n: ' + n + ' pH: ' + pH);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3218 return pH;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3219 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3220
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3221 function calcWater() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3222
644
4654b8ee4690 Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
3223 /* 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
3224 if (! data_loaded) {
644
4654b8ee4690 Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
3225 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
3226 return;
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
3227 }
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
3228
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3229 var liters = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3230 calcium = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3231 magnesium = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3232 sodium = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3233 total_alkalinity = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3234 chloride = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3235 sulfate = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3236 ph = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3237 RA = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3238 frac = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3239 TpH = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3240 protonDeficit = 0,
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3241 AT, BT,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3242 r1d, r2d, f1d, f2d, f3d,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3243 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
3244 Res;
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 if (dataRecord.w1_name == '') {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3247 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3248 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3249
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3250 // If there is a dillute water source, mix the waters.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3251 if (dataRecord.w2_name != '') {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3252 liters = dataRecord.w1_amount + dataRecord.w2_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3253 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
3254 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
3255 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
3256 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
3257 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
3258 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
3259 ph = -Math.log10(((Math.pow(10, -dataRecord.w1_ph) * dataRecord.w1_amount) + (Math.pow(10, -dataRecord.w2_ph) * dataRecord.w2_amount)) / liters);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3260 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3261 liters = dataRecord.w1_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3262 calcium = dataRecord.w1_calcium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3263 magnesium = dataRecord.w1_magnesium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3264 sodium = dataRecord.w1_sodium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3265 chloride = dataRecord.w1_chloride;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3266 sulfate = dataRecord.w1_sulfate;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3267 total_alkalinity = dataRecord.w1_total_alkalinity;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3268 ph = dataRecord.w1_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3269 }
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
3270 var bicarbonate = total_alkalinity * 1.22;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3271
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3272 /* 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
3273 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
3274 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
3275 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
3276 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
3277 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
3278 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
3279
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3280 $('#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
3281 $('#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
3282 $('#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
3283 $('#wg_sodium').val(Round(sodium, 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
3284 $('#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
3285 $('#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
3286 $('#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
3287 $('#wg_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
3288
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3289 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
3290 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
3291
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3292 /* 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
3293 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
3294 calcium += (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 * 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
3295 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 * 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
3296 magnesium += (parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMMg / 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
3297 sodium += (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 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
3298 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3 * 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
3299 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
3300 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
3301 chloride += (2 * parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 * 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
3302 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl * 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
3303 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3304
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3305 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
3306 $('#wa_acid_name').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3307 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
3308 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
3309 $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc);
478
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 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
3312 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
3313
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3314 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
3315 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
3316 $('#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
3317 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3318
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3319 if (dataRecord.wa_base_name < 0 || dataRecord.wa_base_name > 3) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3320 $('#wa_base_name').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3321 dataRecord.wa_base_name = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3322 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3323 if (last_base == '')
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
3324 last_base = BaseTypeData[dataRecord.wa_base_name].nl;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3325
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3326 AT = dataRecord.wa_acid_name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3327 BT = dataRecord.wa_base_name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3328
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
3329 /* 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
3330 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
3331
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3332 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
3333 /* 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
3334 $('.c_mashph').show();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3335 TpH = parseFloat(dataRecord.mash_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3336 protonDeficit = ProtonDeficit(TpH);
644
4654b8ee4690 Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
3337 //console.log('calc_acid tgt: ' + TpH + ' protonDeficit: ' + protonDeficit);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3338 if (protonDeficit > 0) { // Add acid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3339 $('#wa_base').val(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
3340 dataRecord.wa_base = 0;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3341 setWaterAgent(last_base, 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
3342 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
3343 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
3344 Acid *= AcidTypeData[AT].MolWt; // mg
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3345 Acidmg = 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
3346 Acid = Acid / AcidTypeData[AT].AcidSG; // 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
3347 Acid = Round(Acid / (parseFloat(dataRecord.wa_acid_perc) / 100), 2); // 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
3348 console.log('Mash auto Acid final ml: ' + Acid);
495
fdbb6bfae569 Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents: 490
diff changeset
3349 $('#wa_acid').val(Acid);
fdbb6bfae569 Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents: 490
diff changeset
3350 setWaterAgent(AcidTypeData[AT].nl, Acid);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3351
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3352 bicarbonate = bicarbonate - protonDeficit * frac / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3353 total_alkalinity = bicarbonate * 50 / 61;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3354 } else if (protonDeficit < 0) { //Add base
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3355 $('#wa_acid').val(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
3356 dataRecord.wa_acid = 0;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3357 setWaterAgent(last_acid, 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
3358 r1d = Math.pow(10, (TpH - 6.35));
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3359 r2d = Math.pow(10, (TpH - 10.33));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3360 f1d = 1 / (1 + r1d + r1d * r2d);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3361 f2d = f1d * r1d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3362 f3d = f2d * r2d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3363 switch (BT) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3364 case 0:
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3365 RA = -protonDeficit / (f1d - f3d); // Sodiumbicarbonate, mmol totaal
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3366 RA = RA * MMNaHCO3 / 1000; //gram
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3367 $('#wa_base').val(Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3368 setWaterAgent('NaHCO3', Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3369 if (liters > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3370 // Na
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
3371 RA = (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 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
3372 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3 * 1000) / liters;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3373 sodium = wg_sodium + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3374 // HCO3
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
3375 RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3 * 1000) / liters;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3376 bicarbonate = wg_bicarbonate + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3377 total_alkalinity = bicarbonate * 50 / 61;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3378 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3379 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3380 case 1:
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3381 RA = -protonDeficit / (2 * f1d + f2d); // Sodiumcarbonate, mmol totaal
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3382 RA = RA * MMNa2CO3 / 1000; //gram
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3383 $('#wa_base').val(Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3384 setWaterAgent('Na2CO3', Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3385 if (liters > 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
3386 RA = (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 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
3387 parseFloat($('#wa_base').jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3 * 1000) / liters;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3388 sodium = wg_sodium + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3389 // HCO3
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
3390 RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3 * 1000) / liters;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3391 bicarbonate = wg_bicarbonate + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3392 total_alkalinity = bicarbonate * 50 / 61;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3393 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3394 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3395 case 2:
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3396 RA = -protonDeficit * (f1d - f3d); // Calciumcarbonate, mmol totaal
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3397 RA = RA * MMCaCO3 / 1000; //gram
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3398 //but only 1/3 is effective, so add 3 times as much
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3399 RA = 3 * RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3400 $('#wa_base').val(Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3401 setWaterAgent('CaCO3', Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3402 if (liters > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3403 //Bicarbonate
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
3404 RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3 * 1000) / liters;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3405 bicarbonate = wg_bicarbonate + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3406 total_alkalinity = bicarbonate * 50 / 61;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3407 //Ca precipitates out as Ca10(PO4)6(OH)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
3408 RA = (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 * 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
3409 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / 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
3410 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa / MMCaCO3 * 1000) / liters;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3411 calcium = wg_calcium + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3412 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3413 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3414 case 3:
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3415 RA = -protonDeficit / 19.3; // Calciumhydroxide
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3416 $('#wa_base').val(Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3417 setWaterAgent('Ca(OH)2', Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3418 if (liters > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3419 // Bicarbonate
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3420 RA = -protonDeficit / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3421 total_alkalinity = wg_total_alkalinity + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3422 bicarbonate = total_alkalinity * 61 / 50;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3423 // Calcium
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
3424 RA = (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 * 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
3425 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / 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
3426 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa / MMCaOH2 * 1000) / liters;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3427 calcium = wg_calcium + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3428 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3429 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3430 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3431 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3432 ph = TpH;
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
3433 $('#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
3434 $('#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
3435 } 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
3436 /* 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
3437 $('.c_mashph').hide();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3438 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
3439 if (parseFloat($('#wa_base').jqxNumberInput('decimal')) > 0 && 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
3440 /* First add the base 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
3441 switch (BT) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3442 case 0: // Sodiumbicarbonate, Na
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3443 RA = (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 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
3444 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3 * 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
3445 sodium = wg_sodium + RA;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3446 // HCO3
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3447 RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3 * 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
3448 bicarbonate = wg_bicarbonate + RA;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3449 total_alkalinity = bicarbonate * 50 / 61;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3450 break;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3451 case 1: // Sodiumcarbonate
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3452 RA = (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 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
3453 parseFloat($('#wa_base').jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3 * 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
3454 sodium = wg_sodium + RA;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3455 // HCO3
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3456 RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3 * 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
3457 bicarbonate = wg_bicarbonate + RA;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3458 total_alkalinity = bicarbonate * 50 / 61;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3459 break;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3460 case 2: // Calciumcarbonate: 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
3461 RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) / 3 * MMHCO3 * 1000 / MMCaCO3) / 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
3462 bicarbonate = wg_bicarbonate + RA;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3463 total_alkalinity = bicarbonate * 50 / 61;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3464 // Ca
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3465 RA = (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa * 1000 / MMCaCl2 +
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3466 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa * 1000 / MMCaSO4 +
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3467 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa * 1000/ MMCaCO3) / 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
3468 calcium = wg_calcium + RA;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3469 break;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3470 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3471 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3472
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
3473 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
3474 // 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
3475 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
3476 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
3477 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
3478 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
3479 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
3480
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3481 //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
3482 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
3483 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
3484 //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
3485
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3486 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
3487 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
3488 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
3489 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
3490 while (((pd < (protonDeficit - deltapd)) || (pd > (protonDeficit + deltapd))) && (n < 4000)) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3491 n++;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3492 if (pd < (protonDeficit - deltapd))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3493 pHa -= deltapH;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3494 else if (pd > (protonDeficit + deltapd))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3495 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
3496 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
3497 protonDeficit = Acid * frac;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3498 pd = ProtonDeficit(pHa);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3499 }
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
3500 //console.log('n: ' + n + ' pd: ' + pd + ' protonDeficit: ' + protonDeficit + ' frac: ' + frac + ' pHa: ' + 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
3501 RA = wg_bicarbonate - protonDeficit * frac / 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
3502 bicarbonate = RA;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3503 total_alkalinity = RA * 50 / 61;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3504 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
3505 $('#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
3506 $('#est_mash_ph').val(Round(ph, 2));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3507 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3508
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
3509 if ((AT == 3) && (liters > 0)) { // Sulfuric / Zwavelzuur
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3510 RA = parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3511 parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3512 Acidmg / 1000 * MMSO4 / (MMSO4 + 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3513 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3514 sulfate = wg_sulfate + RA; // Not add to sulfate??
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3515 } else if ((AT == 1) && (liters > 0)) { // Hydrochloric, Zoutzuur
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3516 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3517 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3518 Acidmg / 1000 * MMCl / (MMCl + 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3519 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3520 chloride = wg_chloride + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3521 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3522
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
3523 var BUGU = GetBUGU();
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
3524 $('#tgt_bu').val(Round(BUGU, 2));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3525 // From brouwhulp.
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
3526 if (BUGU < 0.32)
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3527 $('#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
3528 else if (BUGU < 0.43)
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3529 $('#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
3530 else if (BUGU < 0.52)
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3531 $('#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
3532 else if (BUGU < 0.63)
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3533 $('#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
3534 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3535 $('#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
3536
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
3537 // Sulfate to Chloride ratio (Palmer).
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
3538 var OptSO4Clratio = GetOptSO4Clratio();
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
3539 $('#tgt_so4_cl').val(Round(OptSO4Clratio, 1));
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
3540 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
3541 $('#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
3542 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
3543 $('#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
3544 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
3545 $('#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
3546 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
3547 $('#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
3548 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
3549 $('#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
3550 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
3551 $('#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
3552 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
3553 $('#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
3554 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
3555 $('#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
3556 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
3557 RA = sulfate / chloride;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3558 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3559 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
3560 $('#got_so4_cl').val(Round(RA, 1));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3561 Res = 'normaal';
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
3562 if (RA < (0.8 * OptSO4Clratio))
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3563 Res = 'laag';
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
3564 else if (RA > (1.2 * OptSO4Clratio))
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3565 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
3566 setRangeIndicator('so4_cl', Res);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3567
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3568 $('#wb_calcium').val(Round(calcium, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3569 $('#wb_magnesium').val(Round(magnesium, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3570 $('#wb_sodium').val(Round(sodium, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3571 $('#wb_sulfate').val(Round(sulfate, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3572 $('#wb_chloride').val(Round(chloride, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3573 $('#wb_total_alkalinity').val(Round(total_alkalinity, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3574
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3575 if (calcium < 40) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3576 setRangeIndicator('calcium', 'laag');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3577 } else if (calcium > 150) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3578 setRangeIndicator('calcium', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3579 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3580 setRangeIndicator('calcium', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3581 }
607
0efba09a694c Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents: 602
diff changeset
3582 if (magnesium < 10) {
0efba09a694c Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents: 602
diff changeset
3583 setRangeIndicator('magnesium', 'laag');
0efba09a694c Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents: 602
diff changeset
3584 } else if (magnesium > 30) {
0efba09a694c Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents: 602
diff changeset
3585 setRangeIndicator('magnesium', 'hoog');
0efba09a694c Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents: 602
diff changeset
3586 } else {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3587 setRangeIndicator('magnesium', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3588 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3589 if (sodium <= 150) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3590 setRangeIndicator('sodium', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3591 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3592 setRangeIndicator('sodium', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3593 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3594 // Both chloride and sulfate should be above 50 according to
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3595 // John Palmer. So the Cl/SO4 ratio calculation will work.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3596 if (chloride <= 50) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3597 setRangeIndicator('chloride', 'laag');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3598 } else if (chloride <= 100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3599 setRangeIndicator('chloride', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3600 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3601 setRangeIndicator('chloride', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3602 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3603 if (sulfate <= 50) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3604 setRangeIndicator('sulfate', 'laag');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3605 } else if (sulfate <= 350) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3606 setRangeIndicator('sulfate', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3607 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3608 setRangeIndicator('sulfate', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3609 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3610 if (ph < 5.2) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3611 setRangeIndicator('ph', 'laag');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3612 } else if (ph > 5.6) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3613 setRangeIndicator('ph', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3614 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3615 setRangeIndicator('ph', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3616 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3617 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3618 calcMiscs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3619 calcSupplies();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3620 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3621
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3622 function calcSparge() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3623
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
3624 /* Based on the work of ajDeLange. */
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3625 var TargetpH = dataRecord.sparge_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
3626 var Source_pH = dataRecord.w1_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
3627 var Source_alkalinity = dataRecord.w1_total_alkalinity;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3628 // Select watersource or fallback to the first source.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3629 if (dataRecord.sparge_source == 1) { // Source 2
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3630 if (dataRecord.w2_ph > 0.0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3631 Source_pH = dataRecord.w2_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3632 Source_alkalinity = dataRecord.w2_total_alkalinity;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3633 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3634 dataRecord.sparge_source = 0; // Source 1
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3635 $('#sparge_source').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3636 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3637 } else if (dataRecord.sparge_source == 2) { // Mixed
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3638 if (dataRecord.w2_ph > 0.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
3639 Source_pH = parseFloat(dataRecord.wg_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
3640 Source_alkalinity = parseFloat(dataRecord.wg_total_alkalinity);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3641 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3642 dataRecord.sparge_source = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3643 $('#sparge_source').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3644 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3645 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3646
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
3647 // Step 1: Compute the mole fractions of carbonic (f1) and carbonate(f3) at the source 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
3648 var r1 = Math.pow(10, Source_pH - 6.35);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3649 var r2 = Math.pow(10, Source_pH - 10.33);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3650 var d = 1 + r1 + r1 * r2;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3651 var f1 = 1 / d;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3652 var f3 = r1 * r2 / d;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3653
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3654 //Step 2. Compute the mole fractions at pH = 4.3 (the pH which defines alkalinity)
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
3655 var r143 = Math.pow(10, 4.3 - 6.35);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3656 var r243 = Math.pow(10, 4.3 - 10.33);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3657 var d43 = 1 + r143 + r143 * r243;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3658 var f143 = 1 / d43;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3659 var f343 = r143 * r243 / d43;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3660
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3661 //Step 4. Solve
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
3662 var Ct = Source_alkalinity / 50 / ((f143 - f1) + (f3 - f343));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3663
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3664 //Step 5. Compute mole fractions at desired 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
3665 var r1g = Math.pow(10, TargetpH - 6.35);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3666 var r2g = Math.pow(10, TargetpH - 10.33);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3667 var dg = 1 + r1g + r1g * r2g;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3668 var f1g = 1 / dg;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3669 var f3g = r1g * r2g / dg;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3670
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3671 //Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L)
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
3672 var Acid = Ct * ((f1g - f1) + (f3 - f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH); //mEq/l
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3673 Acid += 0.01; // Add acid that would be required for distilled water.
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
3674
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3675 //Step 8. Get the acid data.
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3676 var AT = dataRecord.sparge_acid_type;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3677 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
3678 AT = 0;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3679 dataRecord.sparge_acid_type = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3680 $('#sparge_acid_type').val(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
3681 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
3682 $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3683 }
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
3684 var fract = CalcFrac(TargetpH, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3685
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3686 //Step 9. Now divide the mEq required by the "fraction". This is the required number of moles of acid.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3687 Acid /= fract;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3688
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3689 //Step 10. Multiply by molecular weight of the 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
3690 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
3691
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
3692 //Step 11. Divide by Specific Gravity and Percentage to get the final 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
3693 Acid = Acid / AcidTypeData[AT].AcidSG / (dataRecord.sparge_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
3694 Acid *= dataRecord.sparge_volume; //ml acid total
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3695 Acid = Round(Acid, 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3696 dataRecord.sparge_acid_amount = Acid / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3697 $('#sparge_acid_amount').val(Acid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3698 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3699
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3700 function calcFermentation() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3701 var primary_svg, secondary_svg, final_svg, ABV;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3702 if (dataRecord.brew_fermenter_sg < 1.020)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3703 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3704 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
3705 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
3706 $('#primary_svg').val(primary_svg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3707 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
3708 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
3709 $('#secondary_svg').val(secondary_svg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3710 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
3711 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
3712 $('#final_svg').val(final_svg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3713 ABV = Round(abvol(dataRecord.brew_fermenter_sg, dataRecord.fg), 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3714 $('#final_abv').val(ABV);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3715 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3716 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3717 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3718 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3719
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
3720 function ResCO2(T) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3721 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
3722 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
3723 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3724
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3725 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
3726 //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
3727 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
3728 if (sugar < 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3729 sugar = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3730 return Round(sugar, 3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3731 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3732
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3733 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
3734 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
3735 V = CO2; // TODO: temp only total pressure, testing
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3736 if (V < 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3737 return 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3738 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
3739 0.674996600795854 * V + -0.00471757220150754 * V * V;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3740 if (P < 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3741 P = 0;
609
e9b108569818 Testing, bottle carbonation pressure display without residential pressure
Michiel Broek <mbroek@mbse.eu>
parents: 607
diff changeset
3742 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
3743 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
3744 return P;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3745 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3746
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3747 function CarbCO2ToPressure(CO2, T) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3748 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
3749 0.000362999168 * T * T - 0.064872987645 * T + 1.641145175049)) /
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3750 (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
3751 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3752
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3753 function calcCarbonation() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3754
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3755 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
3756
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3757 TSec = dataRecord.secondary_temp;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3758 if (TSec < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3759 TSec = dataRecord.primary_end_temp;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3760 if (TSec < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3761 TSec = 18;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3762
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3763 if (dataRecord.fg == 0.000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3764 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
3765 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3766 ABV = abvol(dataRecord.brew_fermenter_sg, dataRecord.fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3767
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3768 /* Calculate new volume and alcohol. */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3769 bvol = dataRecord.package_volume - (ABV * dataRecord.package_volume) / 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3770 balc = dataRecord.package_volume - bvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3771 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
3772 malc = dataRecord.package_infuse_amount - mvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3773 talc = balc + malc;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3774 tvol = bvol + mvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3775 ABV = Round(talc / (tvol + talc) * 100, 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3776 dataRecord.package_abv = ABV;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3777 $('#package_abv').val(ABV);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3778
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3779 //console.log("calcCarbonation() TSec:"+TSec+" ABV:"+ABV);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3780 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3781 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3782 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3783
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3784 // Bottles
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3785 dataRecord.bottle_priming_amount = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3786 dataRecord.bottle_priming_total = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3787 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3788 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3789 if (row.f_added == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3790 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
3791 dataRecord.bottle_priming_amount = CarbCO2toS(dataRecord.bottle_carbonation, TSec, SFactor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3792 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
3793 $('#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
3794 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3795 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3796 $('#bottle_priming_amount').val(Round(dataRecord.bottle_priming_amount, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3797 $('#bottle_priming_total').val(dataRecord.bottle_priming_total);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3798 pabv = ABV + dataRecord.bottle_priming_amount * 0.47 / 7.907;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3799 pvol = dataRecord.bottle_amount - (pabv * dataRecord.bottle_amount) / 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3800 talc = dataRecord.bottle_amount - pvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3801 tvol = pvol + dataRecord.bottle_priming_water;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3802 babv = Round(talc / (tvol + talc) * 100, 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3803 //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
3804 $('#bottle_abv').val(babv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3805 $('#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
3806
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3807 // Kegs
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3808 Pressure = CarbCO2ToPressure(dataRecord.keg_carbonation, dataRecord.keg_carbonation_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3809 if (Pressure < 0)
557
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3810 Pressure = 0;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3811 dataRecord.keg_pressure = Pressure;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3812 $('#keg_pressure').val(Round(Pressure, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3813
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3814 dataRecord.keg_priming_amount = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3815 dataRecord.keg_priming_total = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3816 if (!dataRecord.keg_forced_carb) {
557
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3817 for (i = 0; i < rows.length; i++) {
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3818 row = rows[i];
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3819 if (row.f_added == 5) {
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3820 SFactor = 1 / ((row.f_yield / 100) * (1 - row.f_moisture / 100));
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3821 dataRecord.keg_priming_amount = CarbCO2toS(dataRecord.keg_carbonation, TSec, SFactor);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3822 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
3823 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', dataRecord.keg_priming_total / 1000);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3824 }
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3825 }
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3826 $('#keg_priming_amount').val(Round(dataRecord.keg_priming_amount, 1));
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3827 $('#keg_priming_total').val(dataRecord.keg_priming_total);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3828 pabv = ABV + dataRecord.keg_priming_amount * 0.47 / 7.907;
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3829 pvol = dataRecord.keg_amount - (pabv * dataRecord.keg_amount) / 100;
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3830 talc = dataRecord.keg_amount - pvol;
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3831 tvol = pvol + dataRecord.keg_priming_water;
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3832 kabv = Round(talc / (tvol + talc) * 100, 2);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3833 //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
3834 $('#keg_abv').val(kabv);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3835 } else {
557
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3836 $('#keg_priming_amount').val(0);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3837 $('#keg_priming_total').val(0);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
3838 $('#keg_abv').val(ABV);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3839 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3840 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3841
723
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3842 function en_stage_equipment(state) {
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3843 $('#equipmentSelect').jqxDropDownList({ disabled: (state) ? true:false });
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3844 $('#Delete').jqxButton({ disabled: (state) ? true:false });
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3845 }
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3846
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3847 function en_stage_brewday(state) {
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3848 $('#jqxTabs').jqxTabs((state) ? 'disableAt':'enableAt', 8); // Brewday tab
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3849 }
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3850
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3851 function en_stage_afterbrew(state) {
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3852
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3853 var onval = { disabled: (state) ? true:false };
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3854 var spinstate = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 90:110 };
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3855 var spinsmall = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 70:90 };
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3856
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3857 $('#jqxTabs').jqxTabs((state) ? 'enableAt':'disableAt', 9); // Fermentation tab
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3858 $('#name').jqxInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3859 $('#code').jqxInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3860 $('#batch_size').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3861 $('#boil_size').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3862 $('#boil_time').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3863 $('#efficiency').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3864 $('#est_og').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3865 $('#type').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3866 $('#styleSelect').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3867 $('#color_method').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3868 $('#ibu_method').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3869 $('#mash_select').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3870 $('#w1_name').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3871 $('#w2_name').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3872 $('#w2_amount').jqxNumberInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3873 $('#pr_name').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3874 $('#wa_cacl2').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3875 $('#wa_caso4').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3876 $('#wa_mgso4').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3877 $('#wa_nacl').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3878 $('#mash_ph').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3879 $('#calc_acid').jqxCheckBox(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3880 $('#wa_base_name').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3881 $('#wa_base').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3882 $('#wa_acid_name').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3883 $('#wa_acid').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3884 $('#wa_acid_perc').jqxNumberInput(spinsmall);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3885 $('#sparge_temp').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3886 $('#sparge_volume').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3887 $('#sparge_ph').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3888 $('#sparge_source').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3889 $('#sparge_acid_type').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3890 $('#sparge_acid_perc').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3891 $('#starter_type').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3892 $('#starter_try').jqxButton(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3893 $('#starter_sg').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3894 $('#yeast_prod_date').jqxDateTimeInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3895 $('#yeast_pitchrate').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3896 $('#but_pickpitchrate').jqxButton(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3897 }
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3898
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3899 function en_stage_afterprimary(istate) {
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3900
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3901 var state = istate;
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3902 var onval = { disabled: (state) ? true:false };
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3903 var spinstate = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 90:110 };
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3904
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3905 $('#brew_date_start').jqxDateTimeInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3906 $('#brew_date_end').jqxDateTimeInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3907 $('#brew_mash_ph').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3908 $('#brew_mash_sg').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3909 $('#brew_whirlpool9').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3910 $('#brew_cooling_to').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3911 $('#brew_whirlpool7').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3912 $('#brew_cooling_method').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3913 $('#brew_whirlpool6').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3914 $('#brew_cooling_time').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3915 $('#brew_sparge_ph').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3916 $('#brew_whirlpool2').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3917 $('#brew_aeration_type').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3918 $('#brew_fermenter_tcloss').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3919 $('#brew_aeration_time').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3920 $('#brew_fermenter_extrawater').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3921 $('#brew_aeration_speed').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3922
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3923 if (! state) {
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3924 state = (dataRecord.boil_time == 0);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3925 }
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3926 onval = { disabled: (state) ? true:false };
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3927 spinstate = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 90:110 };
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3928 $('#brew_preboil_ph').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3929 $('#brew_aboil_ph').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3930 $('#brew_preboil_sg').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3931 $('#brew_aboil_sg').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3932 $('#brew_preboil_volume').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3933 $('#brew_aboil_volume').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3934 $('#but_pre_boil').jqxButton(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3935 $('#but_after_boil').jqxButton(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3936 }
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3937
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3938 function en_stage_tertiary(state) {
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3939 $('#package_date').jqxDateTimeInput({ disabled: (state) ? false:true });
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3940 }
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3941
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3942 function en_stage_aftertertiary(state) {
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3943
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3944 var spinstate = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 90:110 };
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3945
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3946 $('#primary_start_temp').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3947 $('#primary_max_temp').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3948 $('#primary_end_temp').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3949 $('#primary_end_sg').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3950 $('#primary_end_brix').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3951 $('#primary_end_date').jqxDateTimeInput({ disabled: (state) ? true:false });
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3952 }
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3953
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3954 function en_stage_afterpackaging(state) {
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3955
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3956 var onval = { disabled: (state) ? true:false };
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3957 var spinstate = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 90:110 };
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3958
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3959 $('#secondary_temp').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3960 $('#secondary_end_sg').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3961 $('#secondary_end_date').jqxDateTimeInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3962 $('#secondary_end_brix').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3963 $('#tertiary_temp').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3964 $('#fg').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3965 $('#final_brix').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3966 $('#package_date').jqxDateTimeInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3967 $('#package_volume').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3968 $('#package_infuse_amount').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3969 $('#package_infuse_abv').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3970 $('#package_infuse_notes').jqxInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3971 $('#package_ph').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3972 $('#bottle_amount').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3973 $('#bottle_priming_water').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3974 $('#keg_priming_water').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3975 $('#keg_amount').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3976 $('#bottle_carbonation').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3977 $('#keg_carbonation').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3978 $('#bottle_priming_sugar').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3979 $('#keg_priming_sugar').jqxDropDownList(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3980 $('#keg_forced_carb').jqxCheckBox(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3981 $('#bottle_carbonation_temp').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3982 $('#keg_carbonation_temp').jqxNumberInput(spinstate);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3983 }
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3984
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3985 function en_stage_b4taste(state) {
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3986 $('#jqxTabs').jqxTabs((state) ? 'disableAt':'enableAt', 11); // Tasting tab
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3987 }
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3988
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3989 function en_stage_locked(state) {
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3990
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3991 var onval = { disabled: (state) ? true:false };
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3992
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3993 $('#taste_date').jqxDateTimeInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3994 $('#taste_rate').jqxNumberInput({ spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 90:110 });
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3995 $('#taste_color').jqxInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3996 $('#taste_transparency').jqxInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3997 $('#taste_head').jqxInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3998 $('#taste_aroma').jqxInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
3999 $('#taste_taste').jqxInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4000 $('#taste_aftertaste').jqxInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4001 $('#taste_mouthfeel').jqxInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4002 $('#taste_notes').jqxInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4003 $('#notes').jqxInput(onval);
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4004 }
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4005
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4006 function calcStage() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4007
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4008 var newstage = dataRecord.stage, d, date1, date2, date1_unixtime, date2_unixtime, timeDifference, timeDifferenceInDays;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4009
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4010 if (newstage == 0 && dataRecord.est_og > 1.005 && dataRecord.est_color > 3 && dataRecord.est_ibu > 3)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4011 newstage = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4012 if (newstage == 1 && parseFloat($('#brew_date_start').val()) > 2000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4013 newstage = 2; // Brewday
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4014 if (newstage == 2 && ($('#brew_date_start').val() == ''))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4015 newstage = 1; // No brewday
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4016 if (newstage == 2 && parseFloat($('#brew_date_end').val()) > 2000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4017 newstage = 3; // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4018 if (newstage == 3 && parseFloat($('#primary_end_date').val()) > 2000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4019 newstage = 4; // Secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4020 if (newstage == 4 && parseFloat($('#secondary_end_date').val()) > 2000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4021 newstage = 5; // Tertiary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4022 if (newstage == 5 && parseFloat($('#package_date').val()) > 2000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4023 newstage = 6; // Package
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4024 if (newstage >= 6 && newstage < 9) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4025 d = new Date();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4026 date2 = $('#package_date').val();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4027 date2 = date2.split('-');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4028 // Now we convert the array to a Date object
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4029 date1 = new Date(d.getFullYear(), d.getMonth(), d.getDate());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4030 date2 = new Date(date2[0], date2[1] - 1, date2[2]);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4031 // We use the getTime() method and get the unixtime
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4032 date1_unixtime = parseInt(date1.getTime() / 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4033 date2_unixtime = parseInt(date2.getTime() / 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4034 // This is the calculated difference in seconds
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4035 timeDifference = date1_unixtime - date2_unixtime;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4036 timeDifferenceInDays = timeDifference / 60 / 60 / 24;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4037 if (timeDifferenceInDays > 0) { // At least one day
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4038 if (timeDifferenceInDays >= 42) // 6 weeks
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4039 newstage = 9; // Ready to taste
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4040 else if (timeDifferenceInDays >= 14) // 14 days
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4041 newstage = 8; // Mature
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4042 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4043 newstage = 7; // Carbonation
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4044 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4045 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4046 if (newstage == 9 && parseFloat($('#taste_date').val()) > 2000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4047 newstage = 10; // Ready
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4048
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4049 if (newstage != dataRecord.stage) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4050 console.log('calcStage() old: ' + dataRecord.stage + ' new: ' + newstage);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4051 dataRecord.stage = newstage;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4052 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4053
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4054 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4055 * Set stage and enable or disable parts of the screens.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4056 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4057 $('#stage').val(StageData[dataRecord.stage].nl);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4058 if (dataRecord.stage >= 10) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4059 $('#locked').jqxCheckBox({ disabled: false });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4060 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4061
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4062 /*
723
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4063 * Enable or disable parts of the screens.
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4064 */
723
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4065 en_stage_equipment(dataRecord.stage > 1); // When the brew is in progress or done
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4066 en_stage_brewday(dataRecord.stage < 1); // Planning, no ingredients
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4067 en_stage_afterbrew(dataRecord.stage > 2); // After the brew
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4068 en_stage_afterprimary(dataRecord.stage > 3); // Primary fermentation done
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4069 en_stage_tertiary(dataRecord.stage == 5); // Tertiary, allow packaging
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4070 en_stage_aftertertiary(dataRecord.stage >= 5); // After all fermentation steps
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4071 en_stage_afterpackaging(dataRecord.stage >= 6); // After packaging
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4072 en_stage_b4taste(dataRecord.stage < 9); // Taste when at least Mature.
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
4073 en_stage_locked(dataRecord.stage == 11); // Locked.
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4074 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4075
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4076 function showStarter() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4077
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4078 if (dataRecord.starter_enable) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4079 $('#propagator').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4080 $('#starter_type').jqxDropDownList({ disabled: false });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4081 $('#starter_try').jqxButton({ disabled: false });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4082 $('#starter_sg').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4083 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4084 $('#propagator').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4085 $('#starter_type').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4086 $('#starter_try').jqxButton({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4087 $('#starter_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4088 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4089 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4090
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4091 function calcInit() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4092
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4093 calcMashEfficiency();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4094 calcEfficiencyBeforeBoil();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4095 calcEfficiencyAfterBoil();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4096
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4097 $('#starter_try').click(function() {
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
4098 $('#prop1_volume').val(0);
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
4099 $('#prop2_volume').val(0);
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
4100 $('#prop3_volume').val(0);
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
4101 $('#prop4_volume').val(0);
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
4102 dataRecord.prop1_volume = dataRecord.prop2_volume = dataRecord.prop3_volume = dataRecord.prop4_volume = 0;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4103 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4104 });
649
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
4105 $('#starter_type').on('change', function(event) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4106 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4107 dataRecord.starter_type = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4108 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4109 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4110 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4111 $('#starter_sg').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4112 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4113 dataRecord.starter_sg = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4114 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4115 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4116 });
649
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
4117 $('#prop1_type').on('change', function(event) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4118 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4119 dataRecord.prop1_type = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4120 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4121 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4122 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4123 $('#prop1_volume').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4124 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4125 dataRecord.prop1_volume = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4126 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4127 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4128 });
649
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
4129 $('#prop2_type').on('change', function(event) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4130 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4131 dataRecord.prop2_type = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4132 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4133 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4134 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4135 $('#prop2_volume').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4136 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4137 dataRecord.prop2_volume = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4138 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4139 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4140 });
649
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
4141 $('#prop3_type').on('change', function(event) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4142 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4143 dataRecord.prop3_type = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4144 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4145 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4146 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4147 $('#prop3_volume').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4148 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4149 dataRecord.prop3_volume = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4150 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4151 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4152 });
649
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
4153 $('#prop4_type').on('change', function(event) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4154 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4155 dataRecord.prop4_type = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4156 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4157 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4158 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4159 $('#prop4_volume').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4160 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4161 dataRecord.prop4_volume = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4162 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4163 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4164 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4165
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4166 $('#calc_acid').on('checked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4167 dataRecord.calc_acid = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4168 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4169 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4170 $('#calc_acid').on('unchecked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4171 dataRecord.calc_acid = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4172 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4173 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4174 $('#w1_name').jqxDropDownList('selectItem', dataRecord.w1_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4175 $('#w2_name').jqxDropDownList('selectItem', dataRecord.w2_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4176 // Fix tap water if zero using mash infuse amount.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4177 if (parseFloat($('#w1_amount').jqxNumberInput('decimal')) == 0 && mash_infuse > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4178 $('#w1_amount').val(mash_infuse);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4179 dataRecord.w1_amount = mash_infuse;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4180 $('#wg_amount').val(mash_infuse);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4181 $('#w2_amount').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4182 dataRecord.w2_amount = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4183 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4184 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4185 $('#w2_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4186 var newval = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4187
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4188 if (newval > mash_infuse) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4189 $('#w2_amount').val(dataRecord.w2_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4190 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4191 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4192 dataRecord.w1_amount = parseFloat($('#wg_amount').jqxNumberInput('decimal')) - newval;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4193 $('#w1_amount').val(dataRecord.w1_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4194 dataRecord.w2_amount = newval;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4195 console.log('new: ' + event.args.value + ' w1: ' + dataRecord.w1_amount + ' w2: ' + dataRecord.w2_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4196 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4197 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4198 $('#wa_cacl2').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4199 if (event.args) {
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
4200 setWaterAgent('CaCl2', 0); // This prevents double entries.
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4201 setWaterAgent('CaCl2', event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4202 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4203 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4204 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4205 $('#wa_caso4').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4206 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4207 setWaterAgent('CaSO4', 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4208 setWaterAgent('CaSO4', event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4209 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4210 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4211 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4212 $('#wa_mgso4').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4213 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4214 setWaterAgent('MgSO4', 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4215 setWaterAgent('MgSO4', event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4216 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4217 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4218 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4219 $('#wa_nacl').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4220 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4221 setWaterAgent('NaCl', 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4222 setWaterAgent('NaCl', event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4223 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4224 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4225 });
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
4226 $('#wa_base_name').on('select', function(event) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4227 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4228 var index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4229 console.log('wa_base_name ' + index);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4230 setWaterAgent(last_base, 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4231 last_base = BaseTypeData[index].nl;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4232 setWaterAgent(last_base, parseFloat($('#wa_base').jqxNumberInput('decimal')));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4233 dataRecord.wa_base_name = index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4234 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4235 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4236 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4237 $('#wa_base').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4238 var name = BaseTypeData[$('#wa_base_name').val()].nl;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4239 setWaterAgent(name, parseFloat(event.args.value));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4240 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4241 });
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
4242 $('#wa_acid_name').on('select', function(event) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4243 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4244 var index = event.args.index;
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
4245 console.log('wa_acid_name ' + index + ' last_acid: ' + last_acid);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4246 setWaterAgent(last_acid, 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4247 last_acid = AcidTypeData[index].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
4248 dataRecord.wa_acid_name = index;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
4249 dataRecord.wa_acid_perc = AcidTypeData[index].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
4250 $('#wa_acid_perc').val(dataRecord.wa_acid_perc);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
4251 calcWater();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4252 setWaterAgent(last_acid, parseFloat($('#wa_acid').jqxNumberInput('decimal')));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4253 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4254 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4255 $('#wa_acid').on('change', function(event) {
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
4256 var name = AcidTypeData[dataRecord.wa_acid_name].nl;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4257 setWaterAgent(name, parseFloat(event.args.value));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4258 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4259 });
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
4260 $('#wa_acid_perc').on('change', function(event) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
4261 dataRecord.wa_acid_perc = parseFloat(event.args.value);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
4262 calcWater();
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
4263 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4264
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
4265 $('#color_method').on('select', function(event) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4266 dataRecord.color_method = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4267 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4268 });
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
4269 $('#ibu_method').on('select', function(event) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4270 dataRecord.ibu_method = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4271 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4272 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4273 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4274
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4275 $('#batch_size').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4276 console.log('batch_size change:' + event.args.value + ' old:' + dataRecord.batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4277 $('#est_a_vol').val(event.args.value * 1.04);
660
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 658
diff changeset
4278 var evap = parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')) * dataRecord.boil_time / 60;
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 658
diff changeset
4279 dataRecord.boil_size = parseFloat(event.args.value) + evap;
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 658
diff changeset
4280 var factor = parseFloat(event.args.value) / dataRecord.batch_size;
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 658
diff changeset
4281 $('#boil_size').val(Round(dataRecord.boil_size, 2));
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 658
diff changeset
4282 $('#est_pre_vol').val(Round(dataRecord.boil_size * 1.04, 2));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4283 dataRecord.sparge_volume *= factor;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4284 $('#sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4285 $('#brew_sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4286 dataRecord.batch_size = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4287 calcFermentablesFromOG(parseFloat($('#est_og').jqxNumberInput('decimal'))); // Keep the OG
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4288 adjustWaters(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4289 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4290 adjustHops(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4291 adjustMiscs(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4292 adjustYeasts(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4293 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4294 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4295 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4296 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4297 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4298 $('#boil_time').on('change', function(event) {
660
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 658
diff changeset
4299 var new_time, old_time, new_evap;
658
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
4300 old_time = parseFloat(dataRecord.boil_time);
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
4301 new_time = parseFloat(event.args.value);
660
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 658
diff changeset
4302 console.log('boil_time change:' + new_time + ' old:' + old_time);
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 658
diff changeset
4303 new_evap = parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')) * new_time / 60;
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 658
diff changeset
4304 dataRecord.boil_size = parseFloat(dataRecord.batch_size) + new_evap;
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 658
diff changeset
4305 dataRecord.boil_time = new_time;
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 658
diff changeset
4306 $('#est_pre_vol').val(Round(dataRecord.boil_size * 1.04, 2));
0e9a725354ac Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents: 658
diff changeset
4307 $('#boil_size').val(Round(dataRecord.boil_size, 2));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4308 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4309 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4310 calcYeast();
658
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
4311 calcStage();
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
4312 kookTijd();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4313 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4314 $('#efficiency').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4315 var estog = parseFloat($('#est_og').jqxNumberInput('decimal'));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4316 dataRecord.efficiency = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4317 console.log('efficiency change:' + dataRecord.efficiency + ' est_og:' + estog);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4318 calcFermentablesFromOG(estog); // Keep the OG
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4319 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4320 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4321 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4322 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4323 $('#est_og').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4324 dataRecord.est_og = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4325 console.log('est_og change:' + dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4326 $('#est_og2').val(dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4327 calcFermentablesFromOG(dataRecord.est_og); // Adjust fermentables amounts
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4328 calcFermentables(); // Update the recipe details
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4329 calcIBUs(); // and the IBU's.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4330 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4331 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4332 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4333 $('#mash_ph').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4334 dataRecord.mash_ph = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4335 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4336 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4337
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4338 $('#sparge_ph').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4339 dataRecord.sparge_ph = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4340 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4341 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4342 $('#sparge_volume').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4343 dataRecord.sparge_volume = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4344 $('#brew_sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4345 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4346 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4347 $('#sparge_temp').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4348 dataRecord.sparge_temp = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4349 $('#brew_sparge_temperature').val(dataRecord.sparge_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4350 });
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
4351 $('#sparge_source').on('select', function(event) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4352 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4353 dataRecord.sparge_source = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4354 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4355 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4356 });
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
4357 $('#sparge_acid_type').on('select', function(event) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4358 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4359 dataRecord.sparge_acid_type = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4360 console.log('new sparge_acid_type: ' + 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
4361 dataRecord.sparge_acid_perc = AcidTypeData[event.args.index].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
4362 $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4363 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4364 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4365 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4366 $('#sparge_acid_perc').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4367 dataRecord.sparge_acid_perc = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4368 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4369 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4370
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4371 calcFermentation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4372 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4373 $('#package_volume').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4374 var diff, tnew, told = dataRecord.package_volume + dataRecord.package_infuse_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4375 dataRecord.package_volume = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4376 if (dataRecord.package_volume > dataRecord.brew_fermenter_volume) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4377 dataRecord.package_volume = dataRecord.brew_fermenter_volume;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4378 $('#package_volume').val(dataRecord.package_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4379 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4380 tnew = dataRecord.package_volume + dataRecord.package_infuse_amount;
613
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4381 diff = Round(tnew - told, 3);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4382 if (told > 0) {
613
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4383 dataRecord.bottle_amount = Round(dataRecord.bottle_amount + ((dataRecord.bottle_amount / told) * diff), 3);
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4384 dataRecord.keg_amount = Round(dataRecord.keg_amount + ((dataRecord.keg_amount / told) * diff), 3);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4385 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4386 dataRecord.bottle_amount = tnew;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4387 dataRecord.keg_amount = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4388 }
613
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4389 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount));
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4390 $('#keg_amount').val(parseFloat(dataRecord.keg_amount));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4391 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4392 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4393 $('#package_infuse_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4394 var diff, tnew, told = dataRecord.package_volume + dataRecord.package_infuse_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4395 dataRecord.package_infuse_amount = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4396 tnew = dataRecord.package_volume + dataRecord.package_infuse_amount;
613
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4397 diff = Round(tnew - told, 3);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4398 if (told > 0) {
613
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4399 dataRecord.bottle_amount = Round(dataRecord.bottle_amount + ((dataRecord.bottle_amount / told) * diff), 3);
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4400 dataRecord.keg_amount = Round(dataRecord.keg_amount + ((dataRecord.keg_amount / told) * diff), 3);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4401 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4402 dataRecord.bottle_amount = tnew;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4403 dataRecord.keg_amount = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4404 }
613
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4405 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount));
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4406 $('#keg_amount').val(parseFloat(dataRecord.keg_amount));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4407 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4408 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4409 $('#package_infuse_abv').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4410 dataRecord.package_infuse_abv = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4411 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4412 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4413 $('#bottle_amount').on('change', function(event) {
613
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4414 var vtot, vnew = parseFloat(event.args.value);
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4415 vtot = Round(dataRecord.package_volume + dataRecord.package_infuse_amount - dataRecord.keg_amount, 3);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4416 if (vnew > vtot)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4417 vnew = vtot;
613
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4418 dataRecord.bottle_amount = Round(vnew, 3);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4419 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount));
613
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4420 console.log('vtot:' + vtot + ' vnew:' + vnew + ' bottle:' + dataRecord.bottle_amount + ' keg:' + dataRecord.keg_amount);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4421 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4422 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4423 $('#bottle_priming_water').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4424 dataRecord.bottle_priming_water = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4425 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4426 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4427 $('#keg_amount').on('change', function(event) {
613
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4428 var vtot, vnew = parseFloat(event.args.value);
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4429 vtot = Round(dataRecord.package_volume + dataRecord.package_infuse_amount - dataRecord.bottle_amount, 3);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4430 if (vnew > vtot)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4431 vnew = vtot;
613
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4432 dataRecord.keg_amount = Round(vnew, 3);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4433 $('#keg_amount').val(parseFloat(dataRecord.keg_amount));
613
26a7a04acef3 Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents: 612
diff changeset
4434 console.log('vtot:' + vtot + ' vnew:' + vnew + ' bottle:' + dataRecord.bottle_amount + ' keg:' + dataRecord.keg_amount);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4435 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4436 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4437 $('#keg_priming_water').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4438 dataRecord.keg_priming_water = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4439 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4440 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4441 $('#bottle_carbonation').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4442 dataRecord.bottle_carbonation = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4443 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4444 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4445 $('#bottle_carbonation_temp').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4446 dataRecord.bottle_carbonation_temp = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4447 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4448 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4449 $('#keg_carbonation').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4450 dataRecord.keg_carbonation = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4451 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4452 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4453 $('#keg_forced_carb').on('checked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4454 dataRecord.keg_forced_carb = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4455 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4456 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4457 $('#keg_forced_carb').on('unchecked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4458 dataRecord.keg_forced_carb = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4459 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4460 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4461 $('#keg_carbonation_temp').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4462 dataRecord.keg_carbonation_temp = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4463 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4464 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4465
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4466 $('#brew_fermenter_extrawater').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4467 dataRecord.brew_fermenter_extrawater = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4468 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4469 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4470 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4471 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4472 $('#brew_fermenter_tcloss').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4473 dataRecord.brew_fermenter_tcloss = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4474 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4475 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4476 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4477 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4478 $('#primary_end_sg').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4479 dataRecord.primary_end_sg = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4480 calcFermentation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4481 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4482 $('#primary_end_brix').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4483 var OBrix, FBrix, FG;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4484 if (dataRecord.brew_fermenter_sg >= 1.020) {
721
4d7394ced1c3 Better FG calculation from the refractometer reading. Now using the Petr Novotny formula.
Michiel Broek <mbroek@mbse.eu>
parents: 714
diff changeset
4485 OBrix = sg_to_plato(dataRecord.brew_fermenter_sg);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4486 FBrix = parseFloat(event.args.value);
561
dc618b8a9552 Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents: 560
diff changeset
4487 FG = brix_to_fg(OBrix, FBrix);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4488 if (FBrix > 0.05) {
561
dc618b8a9552 Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents: 560
diff changeset
4489 $('#primary_end_sg').val(FG);
dc618b8a9552 Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents: 560
diff changeset
4490 dataRecord.primary_end_sg = FG;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4491 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4492 calcFermentation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4493 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4494 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4495 $('#secondary_end_sg').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4496 dataRecord.secondary_end_sg = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4497 calcFermentation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4498 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4499 $('#secondary_end_brix').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4500 var OBrix, FBrix, FG;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4501 if (dataRecord.brew_fermenter_sg >= 1.020) {
721
4d7394ced1c3 Better FG calculation from the refractometer reading. Now using the Petr Novotny formula.
Michiel Broek <mbroek@mbse.eu>
parents: 714
diff changeset
4502 OBrix = sg_to_plato(dataRecord.brew_fermenter_sg);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4503 FBrix = parseFloat(event.args.value);
561
dc618b8a9552 Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents: 560
diff changeset
4504 FG = brix_to_fg(OBrix, FBrix);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4505 if (FBrix > 0.05) {
561
dc618b8a9552 Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents: 560
diff changeset
4506 $('#secondary_end_sg').val(FG);
dc618b8a9552 Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents: 560
diff changeset
4507 dataRecord.secondary_end_sg = FG;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4508 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4509 calcFermentation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4510 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4511 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4512 $('#final_brix').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4513 var OBrix, FBrix, FG;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4514 if (dataRecord.brew_fermenter_sg >= 1.020) {
721
4d7394ced1c3 Better FG calculation from the refractometer reading. Now using the Petr Novotny formula.
Michiel Broek <mbroek@mbse.eu>
parents: 714
diff changeset
4515 OBrix = sg_to_plato(dataRecord.brew_fermenter_sg);
560
850e82c1021d Switched FG calculations from Brix to the new cubic method from http://seanterrill.com. This includes the brix correction factor and seems better then the Brouwhulp formula.
Michiel Broek <mbroek@mbse.eu>
parents: 559
diff changeset
4516 FBrix = parseFloat(event.args.value);
561
dc618b8a9552 Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents: 560
diff changeset
4517 FG = brix_to_fg(OBrix, FBrix);
560
850e82c1021d Switched FG calculations from Brix to the new cubic method from http://seanterrill.com. This includes the brix correction factor and seems better then the Brouwhulp formula.
Michiel Broek <mbroek@mbse.eu>
parents: 559
diff changeset
4518 if (FBrix > 0.05) {
561
dc618b8a9552 Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents: 560
diff changeset
4519 $('#fg').val(FG);
dc618b8a9552 Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents: 560
diff changeset
4520 dataRecord.fg = FG;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4521 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4522 calcFermentation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4523 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4524 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4525 $('#fg').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4526 dataRecord.fg = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4527 calcFermentation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4528 });
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4529 $('#brew_whirlpool9').on('valueChanged', function(event) {
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4530 dataRecord.brew_whirlpool9 = event.args.value;
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4531 whirlpoolHops();
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4532 calcIBUs();
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4533 });
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4534 $('#brew_whirlpool7').on('valueChanged', function(event) {
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4535 dataRecord.brew_whirlpool7 = event.args.value;
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4536 whirlpoolHops();
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4537 calcIBUs();
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4538 });
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4539 $('#brew_whirlpool6').on('valueChanged', function(event) {
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4540 dataRecord.brew_whirlpool6 = event.args.value;
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4541 whirlpoolHops();
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4542 calcIBUs();
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4543 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4544 $('#BLog').jqxButton({ disabled: (dataRecord.log_brew) ? false : true});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4545 $('#FLog').jqxButton({ disabled: (dataRecord.log_fermentation) ? false : true});
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
4546 $('#ILog').jqxButton({ disabled: (dataRecord.log_ispindel) ? false : true});
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
4547 $('#CLog').jqxButton({ disabled: (dataRecord.log_co2pressure) ? false : true});
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4548 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4549
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4550 $('#styleSelect').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4551 placeHolder: 'Kies bierstijl:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4552 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4553 source: styleslist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4554 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4555 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4556 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4557 dropDownVerticalAlignment: 'top',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4558 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4559 dropDownHeight: 380,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4560 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4561 var datarecord = styleslist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4562 return datarecord.style_guide + ' ' + datarecord.style_letter + ' ' + datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4563 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4564 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4565 $('#styleSelect').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4566 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4567 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4568 datarecord = styleslist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4569 $('#st_name').val(datarecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4570 $('#st_category').val(datarecord.category);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4571 $('#st_category_number').val(datarecord.category_number);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4572 $('#st_letter').val(datarecord.style_letter);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4573 $('#st_guide').val(datarecord.style_guide);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4574 $('#st_type').val(StyleTypeData[datarecord.type].nl);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4575 $('#st_og_min').val(datarecord.og_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4576 $('#st_og_max').val(datarecord.og_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4577 $('#st_fg_min').val(datarecord.fg_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4578 $('#st_fg_max').val(datarecord.fg_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4579 $('#st_ibu_min').val(datarecord.ibu_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4580 $('#st_ibu_max').val(datarecord.ibu_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4581 $('#st_color_min').val(datarecord.color_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4582 $('#st_color_max').val(datarecord.color_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4583 $('#st_carb_min').val(datarecord.carb_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4584 $('#st_carb_min2').val(datarecord.carb_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4585 $('#st_carb_max').val(datarecord.carb_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4586 $('#st_carb_max2').val(datarecord.carb_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4587 $('#st_abv_min').val(datarecord.abv_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4588 $('#st_abv_max').val(datarecord.abv_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4589 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4590 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4591
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4592 // Equipemnt dropdown list
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4593 $('#equipmentSelect').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4594 placeHolder: 'Kies apparatuur:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4595 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4596 source: equipmentlist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4597 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4598 width: 170,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4599 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4600 dropDownWidth: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4601 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4602 var datarecord = equipmentlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4603 return datarecord.batch_size + ' liter ' + datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4604 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4605 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4606 $('#equipmentSelect').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4607 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4608 var datarecord, factor, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4609 datarecord = equipmentlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4610 factor = datarecord.batch_size / dataRecord.batch_size;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4611 $('#eq_name').val(datarecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4612 $('#eq_boil_size').val(datarecord.boil_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4613 dataRecord.boil_size = datarecord.boil_size;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4614 $('#boil_size').val(datarecord.boil_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4615 $('#eq_batch_size').val(datarecord.batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4616 dataRecord.batch_size = datarecord.batch_size;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4617 $('#batch_size').val(datarecord.batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4618 $('#est_a_vol').val(datarecord.batch_size * 1.04);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4619 $('#eq_tun_volume').val(datarecord.tun_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4620 dataRecord.eq_tun_weight = datarecord.tun_weight;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4621 dataRecord.eq_tun_specific_heat = datarecord.tun_specific_heat;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4622 dataRecord.eq_tun_material = datarecord.tun_material;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4623 dataRecord.eq_tun_height = datarecord.tun_height / 100.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4624 $('#eq_top_up_water').val(datarecord.top_up_water);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4625 dataRecord.eq_trub_chiller_loss = datarecord.trub_chiller_loss;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4626 $('#eq_trub_chiller_loss').val(datarecord.trub_chiller_loss);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4627 $('#eq_evap_rate').val(datarecord.evap_rate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4628 $('#eq_boil_time').val(datarecord.boil_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4629 dataRecord.eq_calc_boil_volume = datarecord.calc_boil_volume;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4630 $('#eq_top_up_kettle').val(datarecord.top_up_kettle);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4631 $('#eq_hop_utilization').val(datarecord.hop_utilization);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4632 $('#eq_notes').val(datarecord.notes);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4633 $('#eq_lauter_volume').val(datarecord.lauter_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4634 dataRecord.eq_lauter_height = datarecord.lauter_height / 100.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4635 $('#eq_lauter_deadspace').val(datarecord.lauter_deadspace);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4636 $('#eq_kettle_volume').val(datarecord.kettle_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4637 dataRecord.eq_kettle_height = datarecord.kettle_height / 100.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4638 $('#eq_mash_volume').val(datarecord.mash_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4639 $('#eq_mash_max').val(datarecord.mash_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4640 dataRecord.eq_mash_max = datarecord.mash_max;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4641 $('#mash_max').val(datarecord.mash_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4642 $('#eq_efficiency').val(datarecord.efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4643 dataRecord.efficiency = datarecord.efficiency;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4644 $('#efficiency').val(datarecord.efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4645
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4646 dataRecord.sparge_volume = Math.round(datarecord.boil_size * 5) / 10;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4647 $('#sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4648 $('#brew_sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4649 $('#est_pre_vol').val(datarecord.boil_size * 1.04);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4650 calcFermentablesFromOG(parseFloat($('#est_og').jqxNumberInput('decimal'))); // Keep the OG
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4651 adjustWaters(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4652 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4653 adjustHops(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4654 adjustMiscs(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4655 adjustYeasts(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4656 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4657 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4658 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4659 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4660 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4661
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
4662 function saveRecord(goback) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4663 var row = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4664 record: my_record,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4665 uuid: dataRecord.uuid,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4666 name: $('#name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4667 code: $('#code').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4668 birth: $('#birth').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4669 stage: dataRecord.stage,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4670 notes: $('#notes').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4671 log_brew: dataRecord.log_brew,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4672 log_fermentation: dataRecord.log_fermentation,
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
4673 log_ispindel: dataRecord.log_ispindel,
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
4674 log_co2pressure: dataRecord.log_co2pressure,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4675 inventory_reduced: dataRecord.inventory_reduced,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4676 locked: dataRecord.locked,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4677 eq_name: $('#eq_name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4678 eq_boil_size: parseFloat($('#eq_boil_size').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4679 eq_batch_size: parseFloat($('#eq_batch_size').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4680 eq_tun_volume: parseFloat($('#eq_tun_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4681 eq_tun_weight: dataRecord.eq_tun_weight,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4682 eq_tun_specific_heat: dataRecord.eq_tun_specific_heat,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4683 eq_tun_material: dataRecord.eq_tun_material,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4684 eq_tun_height: dataRecord.eq_tun_height,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4685 eq_top_up_water: parseFloat($('#eq_top_up_water').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4686 eq_trub_chiller_loss: parseFloat($('#eq_trub_chiller_loss').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4687 eq_evap_rate: parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4688 eq_boil_time: parseFloat($('#eq_boil_time').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4689 eq_calc_boil_volume: dataRecord.eq_calc_boil_volume,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4690 eq_top_up_kettle: parseFloat($('#eq_top_up_kettle').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4691 eq_hop_utilization: parseFloat($('#eq_hop_utilization').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4692 eq_notes: $('#eq_notes').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4693 eq_lauter_volume: parseFloat($('#eq_lauter_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4694 eq_lauter_height: dataRecord.eq_lauter_height,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4695 eq_lauter_deadspace: parseFloat($('#eq_lauter_deadspace').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4696 eq_kettle_volume: parseFloat($('#eq_kettle_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4697 eq_kettle_height: dataRecord.eq_kettle_height,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4698 eq_mash_volume: parseFloat($('#eq_mash_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4699 eq_mash_max: parseFloat($('#eq_mash_max').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4700 eq_efficiency: parseFloat($('#eq_efficiency').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4701 brew_date_start: $('#brew_date_start').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4702 brew_mash_ph: parseFloat($('#brew_mash_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4703 brew_mash_sg: parseFloat($('#brew_mash_sg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4704 brew_mash_efficiency: parseFloat($('#brew_mash_efficiency').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4705 brew_sparge_est: parseFloat($('#brew_sparge_est').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4706 brew_sparge_ph: parseFloat($('#brew_sparge_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4707 brew_preboil_volume: parseFloat($('#brew_preboil_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4708 brew_preboil_sg: parseFloat($('#brew_preboil_sg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4709 brew_preboil_ph: parseFloat($('#brew_preboil_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4710 brew_preboil_efficiency: parseFloat($('#brew_preboil_efficiency').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4711 brew_aboil_volume: parseFloat($('#brew_aboil_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4712 brew_aboil_sg: parseFloat($('#brew_aboil_sg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4713 brew_aboil_ph: parseFloat($('#brew_aboil_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4714 brew_aboil_efficiency: parseFloat($('#brew_aboil_efficiency').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4715 brew_cooling_method: $('#brew_cooling_method').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4716 brew_cooling_time: parseFloat($('#brew_cooling_time').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4717 brew_cooling_to: parseFloat($('#brew_cooling_to').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4718 brew_whirlpool9: parseFloat($('#brew_whirlpool9').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4719 brew_whirlpool7: parseFloat($('#brew_whirlpool7').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4720 brew_whirlpool6: parseFloat($('#brew_whirlpool6').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4721 brew_whirlpool2: parseFloat($('#brew_whirlpool2').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4722 brew_fermenter_volume: parseFloat($('#brew_fermenter_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4723 brew_fermenter_extrawater: parseFloat($('#brew_fermenter_extrawater').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4724 brew_fermenter_tcloss: parseFloat($('#brew_fermenter_tcloss').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4725 brew_aeration_time: parseFloat($('#brew_aeration_time').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4726 brew_aeration_speed: parseFloat($('#brew_aeration_speed').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4727 brew_aeration_type: $('#brew_aeration_type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4728 brew_fermenter_sg: parseFloat($('#brew_fermenter_sg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4729 brew_fermenter_ibu: parseFloat($('#brew_fermenter_ibu').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4730 brew_fermenter_color: parseFloat($('#brew_fermenter_color').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4731 brew_date_end: $('#brew_date_end').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4732 og: dataRecord.og,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4733 fg: parseFloat($('#fg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4734 primary_start_temp: parseFloat($('#primary_start_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4735 primary_max_temp: parseFloat($('#primary_max_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4736 primary_end_temp: parseFloat($('#primary_end_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4737 primary_end_sg: parseFloat($('#primary_end_sg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4738 primary_end_date: $('#primary_end_date').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4739 secondary_temp: parseFloat($('#secondary_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4740 secondary_end_sg: parseFloat($('#secondary_end_sg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4741 secondary_end_date: $('#secondary_end_date').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4742 tertiary_temp: parseFloat($('#tertiary_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4743 package_date: $('#package_date').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4744 package_volume: parseFloat($('#package_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4745 package_infuse_amount: parseFloat($('#package_infuse_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4746 package_infuse_abv: parseFloat($('#package_infuse_abv').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4747 package_infuse_notes: $('#package_infuse_notes').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4748 package_abv: parseFloat($('#package_abv').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4749 package_ph: parseFloat($('#package_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4750 bottle_amount: parseFloat($('#bottle_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4751 bottle_carbonation: parseFloat($('#bottle_carbonation').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4752 bottle_priming_water: parseFloat($('#bottle_priming_water').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4753 bottle_priming_amount: parseFloat($('#bottle_priming_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4754 bottle_carbonation_temp: parseFloat($('#bottle_carbonation_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4755 keg_amount: parseFloat($('#keg_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4756 keg_carbonation: parseFloat($('#keg_carbonation').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4757 keg_priming_water: parseFloat($('#keg_priming_water').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4758 keg_priming_amount: parseFloat($('#keg_priming_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4759 keg_carbonation_temp: parseFloat($('#keg_carbonation_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4760 keg_forced_carb: dataRecord.keg_forced_carb,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4761 keg_pressure: parseFloat($('#keg_pressure').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4762 taste_notes: $('#taste_notes').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4763 taste_rate: parseFloat($('#taste_rate').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4764 taste_date: $('#taste_date').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4765 taste_color: $('#taste_color').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4766 taste_transparency: $('#taste_transparency').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4767 taste_head: $('#taste_head').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4768 taste_aroma: $('#taste_aroma').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4769 taste_taste: $('#taste_taste').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4770 taste_mouthfeel: $('#taste_mouthfeel').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4771 taste_aftertaste: $('#taste_aftertaste').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4772 st_name: $('#st_name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4773 st_letter: $('#st_letter').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4774 st_guide: $('#st_guide').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4775 st_type: dataRecord.st_type,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4776 st_category: $('#st_category').val(),
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
4777 st_category_number: $('#st_category_number').val(),
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4778 st_og_min: parseFloat($('#st_og_min').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4779 st_og_max: parseFloat($('#st_og_max').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4780 st_fg_min: parseFloat($('#st_fg_min').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4781 st_fg_max: parseFloat($('#st_fg_max').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4782 st_ibu_min: parseFloat($('#st_ibu_min').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4783 st_ibu_max: parseFloat($('#st_ibu_max').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4784 st_color_min: parseFloat($('#st_color_min').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4785 st_color_max: parseFloat($('#st_color_max').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4786 st_carb_min: parseFloat($('#st_carb_min').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4787 st_carb_max: parseFloat($('#st_carb_max').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4788 st_abv_min: parseFloat($('#st_abv_min').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4789 st_abv_max: parseFloat($('#st_abv_max').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4790 type: $('#type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4791 batch_size: parseFloat($('#batch_size').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4792 boil_size: parseFloat($('#boil_size').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4793 boil_time: parseFloat($('#boil_time').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4794 efficiency: parseFloat($('#efficiency').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4795 est_og: parseFloat($('#est_og').jqxNumberInput('decimal')),
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
4796 est_og3: parseFloat($('#est_og3').jqxNumberInput('decimal')),
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4797 est_fg: parseFloat($('#est_fg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4798 est_abv: parseFloat($('#est_abv').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4799 est_color: parseFloat($('#est_color').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4800 color_method: $('#color_method').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4801 est_ibu: parseFloat($('#est_ibu').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4802 ibu_method: $('#ibu_method').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4803 est_carb: parseFloat($('#est_carb').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4804 mash_name: $('#mash_name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4805 mash_ph: parseFloat($('#mash_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4806 sparge_temp: parseFloat($('#sparge_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4807 sparge_ph: parseFloat($('#sparge_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4808 sparge_volume: parseFloat($('#sparge_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4809 sparge_source: $('#sparge_source').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4810 sparge_acid_type: $('#sparge_acid_type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4811 sparge_acid_perc: parseFloat($('#sparge_acid_perc').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4812 sparge_acid_amount: dataRecord.sparge_acid_amount,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4813 calc_acid: dataRecord.calc_acid,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4814 w1_name: $('#w1_name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4815 w1_amount: parseFloat($('#w1_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4816 w1_calcium: parseFloat($('#w1_calcium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4817 w1_sulfate: parseFloat($('#w1_sulfate').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4818 w1_chloride: parseFloat($('#w1_chloride').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4819 w1_sodium: parseFloat($('#w1_sodium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4820 w1_magnesium: parseFloat($('#w1_magnesium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4821 w1_total_alkalinity: parseFloat($('#w1_total_alkalinity').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4822 w1_ph: parseFloat($('#w1_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4823 w1_cost: dataRecord.w1_cost,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4824 w2_name: $('#w2_name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4825 w2_amount: parseFloat($('#w2_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4826 w2_calcium: parseFloat($('#w2_calcium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4827 w2_sulfate: parseFloat($('#w2_sulfate').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4828 w2_chloride: parseFloat($('#w2_chloride').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4829 w2_sodium: parseFloat($('#w2_sodium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4830 w2_magnesium: parseFloat($('#w2_magnesium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4831 w2_total_alkalinity: parseFloat($('#w2_total_alkalinity').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4832 w2_ph: parseFloat($('#w2_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4833 w2_cost: dataRecord.w2_cost,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4834 wg_amount: parseFloat($('#wg_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4835 wg_calcium: parseFloat($('#wg_calcium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4836 wg_sulfate: parseFloat($('#wg_sulfate').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4837 wg_chloride: parseFloat($('#wg_chloride').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4838 wg_sodium: parseFloat($('#wg_sodium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4839 wg_magnesium: parseFloat($('#wg_magnesium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4840 wg_total_alkalinity: parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4841 wg_ph: parseFloat($('#wg_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4842 wb_calcium: parseFloat($('#wb_calcium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4843 wb_sulfate: parseFloat($('#wb_sulfate').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4844 wb_chloride: parseFloat($('#wb_chloride').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4845 wb_sodium: parseFloat($('#wb_sodium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4846 wb_magnesium: parseFloat($('#wb_magnesium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4847 wb_total_alkalinity: parseFloat($('#wb_total_alkalinity').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4848 wb_ph: parseFloat($('#wb_ph').jqxNumberInput('decimal')),
638
736c8d29bc87 Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents: 637
diff changeset
4849 wa_acid_name: parseInt($('#wa_acid_name').val()),
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4850 wa_acid_perc: parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')),
638
736c8d29bc87 Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents: 637
diff changeset
4851 wa_base_name: parseInt($('#wa_base_name').val()),
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4852 starter_enable: dataRecord.starter_enable,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4853 starter_type: $('#starter_type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4854 starter_sg: parseFloat($('#starter_sg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4855 starter_viability: parseFloat($('#starter_viability').jqxNumberInput('decimal')),
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
4856 yeast_prod_date: $('#yeast_prod_date').val(),
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
4857 yeast_pitchrate: parseFloat($('#yeast_pitchrate').jqxNumberInput('decimal')),
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4858 prop1_type: $('#prop1_type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4859 prop1_volume: parseFloat($('#prop1_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4860 prop2_type: $('#prop2_type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4861 prop2_volume: parseFloat($('#prop2_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4862 prop3_type: $('#prop3_type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4863 prop3_volume: parseFloat($('#prop3_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4864 prop4_type: $('#prop4_type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4865 prop4_volume: parseFloat($('#prop4_volume').jqxNumberInput('decimal')),
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
4866 divide_type: dataRecord.divide_type,
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
4867 divide_size: dataRecord.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
4868 divide_factor: dataRecord.divide_factor,
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
4869 divide_parts: dataRecord.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
4870 divide_part: dataRecord.divide_part,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4871 fermentables: $('#fermentableGrid').jqxGrid('getrows'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4872 hops: $('#hopGrid').jqxGrid('getrows'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4873 miscs: $('#miscGrid').jqxGrid('getrows'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4874 yeasts: $('#yeastGrid').jqxGrid('getrows'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4875 mashs: $('#mashGrid').jqxGrid('getrows')
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4876 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4877 data = 'update=true&' + $.param(row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4878 $.ajax({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4879 dataType: 'json',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4880 url: url,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4881 cache: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4882 data: data,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4883 async: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4884 type: 'POST',
757
d13be50c0049 Added error handler
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
4885 success: function(data) {
d13be50c0049 Added error handler
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
4886 if (data.error) {
d13be50c0049 Added error handler
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
4887 console.log('saveRecord(' + goback + ') error ' + data.msg);
d13be50c0049 Added error handler
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
4888 alert('SQL fout: ' + data.msg);
d13be50c0049 Added error handler
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
4889 } else {
d13be50c0049 Added error handler
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
4890 console.log('saveRecord(' + goback + ') success');
d13be50c0049 Added error handler
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
4891 }
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
4892 if (goback)
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
4893 window.location.href = my_return;
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
4894 else
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
4895 window.location.href =
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
4896 'prod_export.php?record=' + my_record + '&return=' + my_return + '&select=' + my_select + '&code=' + dataRecord.code + '&name=' + dataRecord.name +
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
4897 '&stage=' + dataRecord.stage + '&split=' + dataRecord.divide_type;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4898 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4899 error: function(jqXHR, textStatus, errorThrown) {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
4900 console.log('saveRecord() ' + textStatus);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4901 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4902 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4903 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4904
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4905 // initialize the input fields.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4906 // Tab 1, Algemeen
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4907 $('#name').jqxTooltip({ content: 'De naam voor dit product.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4908 $('#code').jqxTooltip({ content: 'Product code nummer.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4909 $('#birth').jqxTooltip({ content: 'De ontwerp datum van dit product.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4910 $('#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
4911 $('#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
4912 $('#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
4913 $('#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
4914 $('#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
4915 $('#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
4916 $('#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
4917 $('#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
4918 $('#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
4919 $('#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
4920 $('#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
4921 $('#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
4922 $('#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
4923 $('#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
4924 $('#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
4925 $('#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
4926 $('#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
4927 $('#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
4928 $('#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
4929 $('#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
4930 $('#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
4931 $('#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
4932 $('#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
4933 $('#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
4934 $('#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
4935 $('#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
4936 $('#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
4937 $('#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
4938 $('#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
4939 $('#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
4940 $('#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
4941 $('#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
4942 $('#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
4943 $('#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
4944 $('#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
4945
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
4946 $('#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
4947 $('#code, #stage').jqxInput({ theme: theme, width: 100, height: 23 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4948 $('#locked').jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4949 $('#locked').on('checked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4950 if (dataRecord.stage >= 10) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4951 dataRecord.locked = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4952 dataRecord.stage = 11;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4953 calcStage();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4954 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4955 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4956 $('#locked').on('unchecked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4957 if (dataRecord.stage >= 10) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4958 dataRecord.locked = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4959 dataRecord.stage = 10;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4960 calcStage();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4961 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4962 });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
4963 $('#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
4964 $('#notes').jqxInput({ theme: theme, width: 960, height: 100 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4965 $('#type').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4966 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4967 source: RecipeTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4968 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4969 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4970 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4971 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4972 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4973 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4974 $('#efficiency').jqxNumberInput(Perc1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4975 $('#batch_size').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4976 $('#batch_size').jqxNumberInput({ min: 4 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4977 $('#boil_time').jqxNumberInput(PosInt);
658
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
4978 $('#boil_time').jqxNumberInput({ min: 0, max: 360 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4979 $('#boil_size').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 2, readOnly: true });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
4980 $('#st_guide,#st_name,#st_type,#st_category').jqxInput({ theme: theme, width: 250, height: 23 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4981 $('#est_og').jqxNumberInput(SGopts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4982 $('#est_fg').jqxNumberInput(Show3dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
4983 $('#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
4984 $('#est_ibu,#est_color').jqxNumberInput(Show0dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4985 $('#color_method').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4986 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4987 source: ColorMethodAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4988 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4989 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4990 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4991 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4992 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4993 });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
4994 $('#st_color_min,#st_color_max,#st_category_number,#st_ibu_min,#st_ibu_max,#kcal').jqxNumberInput(Smal0dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4995 $('#ibu_method').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4996 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4997 source: IBUmethodAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4998 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4999 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5000 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5001 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5002 autoDropDownHeight: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5003 dropDownVerticalAlignment: 'top'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5004 });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
5005 $('#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
5006
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5007 // Tab 2, Equipment
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5008 $('#eq_name').jqxTooltip({ content: 'De naam van deze brouw apparatuur.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5009 $('#eq_boil_size').jqxTooltip({ content: 'Normaal kook volume in liters' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5010 $('#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
5011 $('#eq_tun_volume').jqxTooltip({ content: 'Maisch ketel volume.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5012 $('#eq_top_up_water').jqxTooltip({ content: 'Extra water in het gistvat.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5013 $('#eq_trub_chiller_loss').jqxTooltip({ content: 'Standaard verlies bij het overbrengen naar het gistvat.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5014 $('#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
5015 $('#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
5016 $('#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
5017 $('#eq_hop_utilization').jqxTooltip({ content: '100% voor kleine installaties, hoger voor grote brouwerijen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5018 $('#eq_notes').jqxTooltip({ content: 'Opmerkingen over deze apparatuur.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5019 $('#eq_lauter_volume').jqxTooltip({ content: 'Filterkuip volume.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5020 $('#eq_lauter_deadspace').jqxTooltip({ content: 'Filterkuip verlies in liters.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5021 $('#eq_kettle_volume').jqxTooltip({ content: 'Kook ketel volume in liters.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5022 $('#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
5023 $('#eq_mash_max').jqxTooltip({ content: 'De maximale moutstort in Kg.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5024 $('#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
5025
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
5026 $('#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
5027 $('#eq_evap_rate').jqxNumberInput(Show2dec);
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
5028 $('#eq_boil_time,#eq_hop_utilization').jqxNumberInput(Show0dec);
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
5029 $('#eq_notes').jqxInput({ theme: theme, width: 960, height: 200 });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
5030 $('#eq_boil_size,#eq_batch_size,#eq_tun_volume,#eq_top_up_water,#eq_trub_chiller_loss,#eq_top_up_kettle').jqxNumberInput(Show1dec);
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
5031 $('#eq_lauter_volume,#eq_lauter_deadspace,#eq_kettle_volume,#eq_mash_volume,#eq_mash_max,#eq_efficiency').jqxNumberInput(Show1dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5032
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5033 // Tab 3, Fermentables
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5034 $('#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
5035 $('#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
5036 $('#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
5037
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
5038 $('#est_color2').jqxNumberInput(Show0dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
5039 $('#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
5040
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5041 $('#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
5042 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
5043 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
5044 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
5045 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5046 $('#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
5047 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
5048 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
5049 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
5050 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5051 $('#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
5052 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
5053 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
5054 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
5055 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5056 $('#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
5057 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
5058 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
5059 renderText: function(text) { return (parseInt(text) * 2) + ' lintner'; }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5060 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5061 $('#FermentableReady').jqxButton({ template: 'success', width: '90px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5062 $('#FermentableReady').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5063 var row, rowID = $('#fermentableGrid').jqxGrid('getrowid', fermentableRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5064 console.log('FermentableReady row:' + fermentableRow + ' ID:' + rowID);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5065 row = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5066 f_name: fermentableData.f_name,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5067 f_origin: fermentableData.f_origin,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5068 f_supplier: fermentableData.f_supplier,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5069 f_amount: fermentableData.f_amount,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5070 f_cost: fermentableData.f_cost,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5071 f_type: fermentableData.f_type,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5072 f_yield: fermentableData.f_yield,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5073 f_color: fermentableData.f_color,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5074 f_coarse_fine_diff: fermentableData.f_coarse_fine_diff,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5075 f_moisture: fermentableData.f_moisture,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5076 f_diastatic_power: fermentableData.f_diastatic_power,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5077 f_protein: fermentableData.f_protein,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5078 f_max_in_batch: fermentableData.f_max_in_batch,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5079 f_graintype: fermentableData.f_graintype,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5080 f_added: fermentableData.f_added,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5081 f_dissolved_protein: fermentableData.f_dissolved_protein,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5082 f_recommend_mash: fermentableData.f_recommend_mash,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5083 f_add_after_boil: fermentableData.f_add_after_boil,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5084 f_adjust_to_total_100: fermentableData.f_adjust_to_total_100,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5085 f_percentage: fermentableData.f_percentage,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5086 f_di_ph: fermentableData.f_di_ph,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5087 f_acid_to_ph_57: fermentableData.f_acid_to_ph_57,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5088 f_inventory: fermentableData.f_inventory,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5089 f_avail: fermentableData.f_avail
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5090 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5091 $('#fermentableGrid').jqxGrid('updaterow', rowID, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5092 calcPercentages();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5093 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5094 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5095 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5096 // Waters: yes there is impact.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5097 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5098 $('#wf_name').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5099 $('#wf_instock').jqxCheckBox({ theme: theme, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5100 $('#wf_instock').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5101 fermentableinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5102 fermentablelist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5103 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5104 $('#wf_select').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5105 placeHolder: 'Kies mout:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5106 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5107 source: fermentablelist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5108 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5109 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5110 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5111 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5112 dropDownHeight: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5113 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5114 var datarecord = fermentablelist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5115 return datarecord.supplier + ' / ' + datarecord.name + ' (' + datarecord.color + ' EBC)';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5116 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5117 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5118 $('#wf_select').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5119 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5120 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5121 datarecord = fermentablelist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5122 $('#wf_name').val(datarecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5123 fermentableData.f_name = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5124 fermentableData.f_origin = datarecord.origin;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5125 fermentableData.f_supplier = datarecord.supplier;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5126 fermentableData.f_type = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5127 fermentableData.f_cost = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5128 fermentableData.f_yield = datarecord.yield;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5129 fermentableData.f_color = datarecord.color;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5130 fermentableData.f_coarse_fine_diff = datarecord.coarse_fine_diff;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5131 fermentableData.f_moisture = datarecord.moisture;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5132 fermentableData.f_diastatic_power = datarecord.diastatic_power;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5133 fermentableData.f_protein = datarecord.protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5134 fermentableData.f_max_in_batch = datarecord.max_in_batch;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5135 fermentableData.f_graintype = datarecord.graintype;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5136 fermentableData.f_dissolved_protein = datarecord.dissolved_protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5137 fermentableData.f_recommend_mash = datarecord.recommend_mash;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5138 fermentableData.f_add_after_boil = datarecord.add_after_boil;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5139 fermentableData.f_di_ph = datarecord.di_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5140 fermentableData.f_acid_to_ph_57 = datarecord.acid_to_ph_57;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5141 fermentableData.f_inventory = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5142 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5143 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5144 $('#wf_amount').jqxNumberInput(Spin3dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5145 $('#wf_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5146 console.log('amount changed: ' + event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5147 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_amount', event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5148 fermentableData.f_amount = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5149 if (! to_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5150 calcPercentages();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5151 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5152 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5153 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5154 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5155 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5156 $('#wf_percentage').jqxNumberInput(Perc1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5157 $('#wf_percentage').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5158 var newvalue, rowscount, rowdata, diff, tw, damount, namount, nw, newperc,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5159 oldvalue = Math.round(fermentableData.f_percentage * 10) / 10.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5160 newvalue = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5161 console.log('percentage changed: ' + newvalue + ' old: ' + oldvalue);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5162 fermentableData.f_percent = newvalue;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5163 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5164 if ((oldvalue != newvalue) && (rowscount > 1)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5165 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5166 if (rowdata.f_adjust_to_total_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5167 $('#wf_percentage').val(oldvalue);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5168 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5169 diff = newvalue - oldvalue;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5170 tw = 0; // total weight
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5171 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5172 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5173 if (rowdata.f_added < 4)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5174 tw += Math.round(rowdata.f_amount * 1000) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5175 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5176 tw = Math.round(tw * 1000) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5177 if (to_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5178 // Adjust this row and the 100% row.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5179 damount = Math.round(tw * diff * 10) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5180 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5181 namount = Round(rowdata.f_amount + damount, 3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5182 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_amount', namount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5183 $('#wf_amount').val(namount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5184 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_percentage', rowdata.f_percentage + diff);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5185 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5186 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5187 if (rowdata.f_adjust_to_total_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5188 namount = rowdata.f_amount - damount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5189 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', rowdata.f_percentage - diff);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5190 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5191 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5192 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5193 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5194 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5195 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5196 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5197 // Adjust all the rows.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5198 nw = tw * diff / 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5199 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5200 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5201 if (rowdata.f_added < 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5202 if (i == fermentableRow) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5203 namount = Math.round((rowdata.f_amount + nw) * 1000) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5204 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5205 // $('#wf_amount').val(namount); // Will crash the script.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5206 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', newvalue);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5207 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5208 namount = Math.round((rowdata.f_amount - (nw / (rowscount - 1))) * 1000) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5209 newperc = Math.round((namount / tw) * 1000) / 10.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5210 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5211 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', newperc);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5212 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5213 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5214 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5215 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5216 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5217 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5218 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5219 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5220 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5221 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5222 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5223 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5224 $('#wf_max_in_batch').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5225 $('#wf_adjust_to_total_100').jqxCheckBox({ theme: theme, width: 120, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5226 $('#wf_adjust_to_total_100').on('checked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5227 if (fermentableData.f_adjust_to_total_100 == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5228 if (to_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5229 // Reset other flag first.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5230 var i, rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5231 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5232 if (i != fermentableRow) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5233 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_adjust_to_total_100', 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5234 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5235 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5236 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5237 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5238 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5239 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5240 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5241 $('#wf_adjust_to_total_100').on('unchecked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5242 if (fermentableData.f_adjust_to_total_100 != 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5243 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5244 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5245 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5246 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5247 $('#wf_added').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5248 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5249 source: AddedAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5250 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5251 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5252 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5253 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5254 autoDropDownHeight: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5255 dropDownVerticalAlignment: 'top'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5256 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5257 $('#wf_added').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5258 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5259 var index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5260 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_added', index);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5261 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5262 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5263 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5264 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5265 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5266
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5267 // Tab 4, Hops
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5268 $('#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
5269 $('#est_ibu2').jqxNumberInput(Smal0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5270 $('#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
5271 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
5272 colorRanges: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5273 { stop: 20, color: '#004D00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5274 { stop: 40, color: '#008C00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5275 { stop: 60, color: '#00BF00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5276 { stop: 80, color: '#00FF00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5277 { stop: 100, color: '#80FF80' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5278 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5279 renderText: function(text) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5280 var val = parseInt(text);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5281 if (val < 20)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5282 return 'Weinig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5283 else if (val < 40)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5284 return 'Matig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5285 else if (val < 60)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5286 return 'Redelijk';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5287 else if (val < 80)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5288 return 'Veel';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5289 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5290 return 'Zeer veel';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5291 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5292 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5293 $('#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
5294 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
5295 colorRanges: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5296 { stop: 20, color: '#004D00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5297 { stop: 40, color: '#008C00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5298 { stop: 60, color: '#00BF00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5299 { stop: 80, color: '#00FF00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5300 { stop: 100, color: '#80FF80' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5301 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5302 renderText: function(text) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5303 var val = parseInt(text);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5304 if (val < 20)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5305 return 'Weinig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5306 else if (val < 40)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5307 return 'Matig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5308 else if (val < 60)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5309 return 'Redelijk';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5310 else if (val < 80)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5311 return 'Veel';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5312 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5313 return 'Zeer veel';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5314 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5315 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5316 $('#HopReady').jqxButton({ template: 'success', width: '90px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5317 $('#HopReady').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5318 var row, rowID = $('#hopGrid').jqxGrid('getrowid', hopRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5319 row = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5320 h_name: $('#wh_name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5321 h_origin: hopData.h_origin,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5322 h_amount: parseFloat($('#wh_amount').jqxNumberInput('decimal')) / 1000,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5323 h_cost: hopData.h_cost,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5324 h_type: hopData.h_type,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5325 h_form: hopData.h_form,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5326 h_useat: $('#wh_useat').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5327 h_time: hopData.h_time,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5328 h_alpha: hopData.h_alpha,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5329 h_beta: hopData.h_beta,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5330 h_hsi: hopData.h_hsi,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5331 h_humulene: hopData.h_humulene,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5332 h_caryophyllene: hopData.h_caryophyllene,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5333 h_cohumulone: hopData.h_cohumulone,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5334 h_myrcene: hopData.h_myrcene,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5335 h_total_oil: hopData.h_total_oil,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5336 h_inventory: hopData.h_inventory,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5337 h_avail: hopData.h_avail
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5338 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5339 $('#hopGrid').jqxGrid('updaterow', rowID, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5340 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5341 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5342 $('#wh_name').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5343 $('#wh_instock').jqxCheckBox({ theme: theme, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5344 $('#wh_instock').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5345 hopinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5346 hoplist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5347 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5348 $('#wh_select').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5349 placeHolder: 'Kies hop:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5350 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5351 source: hoplist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5352 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5353 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5354 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5355 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5356 dropDownHeight: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5357 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5358 var datarecord = hoplist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5359 return datarecord.origin + ' - ' + datarecord.name + ' / ' + HopFormData[datarecord.form].nl + ' (' + datarecord.alpha + ' % &alpha;)';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5360 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5361 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5362 $('#wh_select').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5363 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5364 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5365 datarecord = hoplist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5366 $('#wh_name').val(datarecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5367 hopData.h_name = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5368 hopData.h_origin = datarecord.origin;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5369 hopData.h_cost = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5370 hopData.h_type = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5371 hopData.h_form = datarecord.form;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5372 hopData.h_alpha = datarecord.alpha;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5373 hopData.h_beta = datarecord.beta;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5374 hopData.h_hsi = datarecord.hsi;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5375 hopData.h_humulene = datarecord.humulene;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5376 hopData.h_caryophyllene = datarecord.caryophyllene;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5377 hopData.h_cohumulone = datarecord.cohumulone;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5378 hopData.h_myrcene = datarecord.myrcene;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5379 hopData.h_total_oil = datarecord.total_oil;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5380 hopData.h_inventory = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5381 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5382 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5383 $('#wh_amount').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5384 $('#wh_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5385 console.log('amount changed: ' + event.args.value + ' time:' + hopData.h_time + ' alpha:' + hopData.h_alpha);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5386 var ibu, amount = parseFloat(event.args.value) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5387 ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')),
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
5388 amount, parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val(),
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
5389 dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5390 );
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5391 hopData.h_amount = amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5392 $('#wh_ibu').val(ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5393 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5394 $('#wh_ibu').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5395 $('#wh_time').jqxNumberInput(PosInt);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5396 $('#wh_time').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5397 var ibu, newtime = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5398 // Check limits and correct
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5399 if (hopData.h_useat == 2) { // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5400 if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5401 newtime = parseFloat($('#boil_time').jqxNumberInput('decimal'));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5402 $('#wh_time').val(newtime);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5403 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5404 hopData.h_time = newtime;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5405 } else if (hopData.h_useat == 5) { // Dry hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5406 if (newtime > 21) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5407 newtime = 21;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5408 $('#wh_time').val(newtime);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5409 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5410 hopData.h_time = newtime * 1440;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5411 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5412 ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')),
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
5413 parseFloat(hopData.h_amount), parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val(),
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
5414 dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5415 $('#wh_ibu').val(ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5416 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5417 $('#wh_useat').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5418 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5419 source: HopUseAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5420 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5421 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5422 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5423 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5424 autoDropDownHeight: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5425 dropDownVerticalAlignment: 'top'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5426 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5427 $('#wh_useat').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5428 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5429 var index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5430 hopData.h_useat = index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5431 if ((index == 0) || (index == 1)) { // Mashhop or First wort hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5432 hopData.h_time = parseFloat(dataRecord.boil_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5433 $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5434 $('#wh_time').val(hopData.h_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5435 } else if (index == 3) { // Aroma
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5436 hopData.h_time = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5437 $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5438 $('#wh_time').val(0);
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
5439 } else if (index == 4) { // Whirlpool
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
5440 hopData.h_time = (parseFloat(dataRecord.brew_whirlpool9) + parseFloat(dataRecord.brew_whirlpool7) + parseFloat(dataRecord.brew_whirlpool6));
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
5441 $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
5442 $('#wh_time').val(hopData.h_time);
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
5443 } else { // Boil, Dry hop
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5444 $('#wh_time').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5445 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5446 if (index == 5) // Dry hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5447 $('#wh_pmpt_time').html('Tijd in dagen');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5448 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5449 $('#wh_pmpt_time').html('Tijd in minuten');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5450 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5451 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5452
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5453 // Tab 5, Miscs
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5454 $('#MiscReady').jqxButton({ template: 'success', width: '90px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5455 $('#MiscReady').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5456 var row, rowID = $('#miscGrid').jqxGrid('getrowid', miscRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5457 console.log('MiscReady row:' + miscRow + ' ID:' + rowID);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5458 row = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5459 m_name: miscData.m_name,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5460 m_amount: miscData.m_amount,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5461 m_cost: miscData.m_cost,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5462 m_type: miscData.m_type,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5463 m_use_use: miscData.m_use_use,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5464 m_time: miscData.m_time,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5465 m_amount_is_weight: miscData.m_amount_is_weight,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5466 m_inventory: miscData.m_inventory,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5467 m_avail: miscData.m_avail
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5468 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5469 $('#miscGrid').jqxGrid('updaterow', rowID, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5470 calcMiscs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5471 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5472 $('#wm_name').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5473 $('#wm_instock').jqxCheckBox({ theme: theme, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5474 $('#wm_instock').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5475 miscinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5476 misclist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5477 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5478 $('#wm_select').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5479 placeHolder: 'Kies ingredi&euml;nt:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5480 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5481 source: misclist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5482 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5483 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5484 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5485 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5486 dropDownHeight: 500
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5487 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5488 $('#wm_select').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5489 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5490 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5491 datarecord = misclist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5492 $('#wm_name').val(datarecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5493 miscData.m_name = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5494 miscData.m_cost = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5495 miscData.m_type = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5496 miscData.m_use_use = datarecord.use_use;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5497 miscData.m_amount_is_weight = datarecord.amount_is_weight;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5498 miscData.m_inventory = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5499 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5500 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5501 $('#wm_amount').jqxNumberInput(Spin2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5502 $('#wm_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5503 console.log('amount changed: ' + event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5504 miscData.m_amount = parseFloat(event.args.value) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5505 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5506 $('#wm_time').jqxNumberInput(PosInt);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5507 $('#wm_time').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5508 var newtime = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5509
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5510 if (miscData.m_use_use == 2) { // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5511 if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5512 newtime = parseFloat($('#boil_time').jqxNumberInput('decimal'));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5513 $('#wm_time').val(newtime);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5514 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5515 miscData.m_time = newtime;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5516 } else if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) { // Primary or Secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5517 if (newtime > 21) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5518 newtime = 21;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5519 $('#wm_time').val(newtime);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5520 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5521 miscData.m_time = newtime * 1440;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5522 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5523 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5524 $('#wm_use_use').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5525 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5526 source: MiscUseAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5527 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5528 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5529 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5530 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5531 autoDropDownHeight: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5532 dropDownVerticalAlignment: 'top'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5533 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5534 $('#wm_use_use').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5535 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5536 var index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5537 miscData.m_use_use = index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5538 if ((index == 2) || (index == 3) || (index == 4)) { // Boil, Primary or Secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5539 $('#wm_time').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5540 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5541 $('#wm_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5542 $('#wm_time').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5543 miscData.m_time = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5544 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5545 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5546 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5547
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5548 // Tab 6, Yeasts
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5549 $('#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
5550 $('#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
5551 $('#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
5552 $('#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
5553 $('#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
5554 $('#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
5555 $('#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
5556 $('#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
5557 $('#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
5558
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
5559 $('#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
5560 $('#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
5561 $('#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
5562 $('#est_abv2').jqxNumberInput({ width: 70, symbol: '%', symbolPosition: 'right' });
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
5563 $('#yeast_grams').jqxNumberInput(Show1dec);
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
5564 $('#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
5565 $('#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
5566 $('#yeast_prod_date').jqxDateTimeInput(Dateopts);
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
5567 $('#yeast_prod_date').on('close', function(event) {
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
5568 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
5569 calcFermentables();
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
5570 calcYeast();
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
5571 });
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
5572 $('#yeast_pitchrate').jqxNumberInput(Spin3dec);
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
5573 $('#yeast_pitchrate').on('change', function(event) {
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
5574 dataRecord.yeast_pitchrate = parseFloat(event.args.value);
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
5575 calcViability();
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
5576 calcFermentables();
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
5577 calcYeast();
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
5578 });
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
5579 $('#but_pickpitchrate').jqxButton({ template: 'success', width: '23px', height: 23, theme: theme });
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
5580 $('#but_pickpitchrate').bind('click', function() {
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
5581 $('#pick_pitchrate').val(0); // Set default pick incase no perfect match.
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
5582 $('#pick_pitchrate').val(dataRecord.yeast_pitchrate);
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
5583 $('#pitchrateWindow').jqxWindow('open');
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
5584 });
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
5585 $('#pick_pitchrate').jqxDropDownList({
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5586 theme: theme,
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
5587 source: PitchrateAdapter,
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
5588 valueMember: 'rate',
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
5589 displayMember: 'nl',
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
5590 width: 275,
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
5591 height: 23,
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
5592 autoDropDownHeight: true,
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
5593 dropDownVerticalAlignment: 'top'
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
5594 });
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
5595 $('#pitchrateReady').jqxButton({ template: 'success', width: '90px', theme: theme });
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
5596 $('#pitchrateReady').click(function() {
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
5597 console.log('pitchrateReady ' + $('#pick_pitchrate').val() );
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
5598 dataRecord.yeast_pitchrate = parseFloat($('#pick_pitchrate').val());
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
5599 $('#yeast_pitchrate').val(dataRecord.yeast_pitchrate);
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
5600 calcViability();
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
5601 calcFermentables();
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
5602 calcYeast();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5603 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5604 $('#YeastReady').jqxButton({ template: 'success', width: '90px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5605 $('#YeastReady').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5606 var row, rowID = $('#yeastGrid').jqxGrid('getrowid', yeastRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5607 console.log('YeastReady row:' + yeastRow + ' ID:' + rowID);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5608 row = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5609 y_name: yeastData.y_name,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5610 y_laboratory: yeastData.y_laboratory,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5611 y_product_id: yeastData.y_product_id,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5612 y_amount: yeastData.y_amount,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5613 y_cost: yeastData.y_cost,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5614 y_type: yeastData.y_type,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5615 y_form: yeastData.y_form,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5616 y_flocculation: yeastData.y_flocculation,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5617 y_min_temperature: yeastData.y_min_temperature,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5618 y_max_temperature: yeastData.y_max_temperature,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5619 y_attenuation: yeastData.y_attenuation,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5620 y_use: yeastData.y_use,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5621 y_cells: yeastData.y_cells,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5622 y_tolerance: yeastData.y_tolerance,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5623 y_inventory: yeastData.y_inventory,
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
5624 y_sta1: yeastData.y_sta1,
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
5625 y_bacteria: yeastData.y_bacteria,
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
5626 y_harvest_top: yeastData.y_harvest_top,
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
5627 y_harvest_time: yeastData.y_harvest_time,
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
5628 y_pitch_temperature: yeastData.y_pitch_temperature,
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
5629 y_pofpos: yeastData.y_pofpos,
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
5630 y_zymocide: yeastData.y_zymocide,
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
5631 y_gr_hl_lo: yeastData.y_gr_hl_lo,
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
5632 y_sg_lo: yeastData.y_sg_lo,
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
5633 y_gr_hl_hi: yeastData.y_gr_hl_hi,
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
5634 y_sg_hi: yeastData.y_sg_hi,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5635 y_avail: yeastData.y_avail
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5636 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5637 $('#yeastGrid').jqxGrid('updaterow', rowID, row);
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
5638 calcViability();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5639 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5640 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5641 });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
5642 $('#wy_name,#wy_laboratory,#wy_product_id').jqxInput({ theme: theme, width: 320, height: 23 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5643 $('#wy_instock').jqxCheckBox({ theme: theme, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5644 $('#wy_instock').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5645 yeastinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5646 yeastlist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5647 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5648 $('#wy_select').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5649 placeHolder: 'Kies gist:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5650 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5651 source: yeastlist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5652 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5653 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5654 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5655 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5656 dropDownHeight: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5657 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5658 var datarecord = yeastlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5659 return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5660 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5661 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5662 $('#wy_select').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5663 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5664 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5665 datarecord = yeastlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5666 $('#wy_name').val(datarecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5667 $('#wy_laboratory').val(datarecord.laboratory);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5668 $('#wy_product_id').val(datarecord.product_id);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5669 yeastData.y_name = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5670 yeastData.y_cost = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5671 yeastData.y_type = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5672 yeastData.y_form = datarecord.form;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5673 yeastData.y_laboratory = datarecord.laboratory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5674 yeastData.y_product_id = datarecord.product_id;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5675 yeastData.y_min_temperature = datarecord.min_temperature;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5676 yeastData.y_max_temperature = datarecord.max_temperature;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5677 yeastData.y_flocculation = datarecord.flocculation;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5678 yeastData.y_attenuation = datarecord.attenuation;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5679 yeastData.y_cells = datarecord.cells;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5680 yeastData.y_inventory = datarecord.inventory;
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
5681 yeastData.y_sta1 = datarecord.sta1;
561
dc618b8a9552 Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents: 560
diff changeset
5682 yeastData.y_bacteria = datarecord.bacteria;
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
5683 yeastData.y_harvest_top = datarecord.harvest_top;
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
5684 yeastData.y_harvest_time = datarecord.harvest_time;
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
5685 yeastData.y_pitch_temperature = datarecord.pitch_temperature;
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
5686 yeastData.y_pofpos = datarecord.pofpos;
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
5687 yeastData.y_zymocide = datarecord.zymocide;
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
5688 yeastData.y_gr_hl_lo = datarecord.gr_hl_lo;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
5689 yeastData.y_sg_lo = datarecord.sg_lo;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
5690 yeastData.y_gr_hl_hi = datarecord.gr_hl_hi;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
5691 yeastData.y_sg_hi = datarecord.sg_hi;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5692 if (yeastData.y_form == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5693 $('#wy_pmpt_amount').html('Pak(ken):');
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
5694 } else if (yeastData.y_form == 1 || yeastData.y_form == 6) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5695 $('#wy_pmpt_amount').html('Gewicht gram:');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5696 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5697 $('#wy_pmpt_amount').html('Volume ml:');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5698 }
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
5699 calcViability();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5700 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5701 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5702 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5703 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5704 $('#wy_amount').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5705 $('#wy_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5706 var amount = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5707 if (yeastData.y_form != 0) // not Liquid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5708 amount = parseFloat(event.args.value) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5709 yeastData.y_amount = amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5710 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5711 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5712 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5713 $('#wy_use').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5714 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5715 source: YeastUseAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5716 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5717 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5718 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5719 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5720 autoDropDownHeight: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5721 dropDownVerticalAlignment: 'top'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5722 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5723 $('#wy_use').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5724 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5725 var index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5726 yeastData.y_use = index;
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
5727 calcViability();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5728 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5729 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5730 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5731 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5732 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
5733 $('#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
5734 $('#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
5735 $('#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
5736 $('#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
5737 $('#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
5738
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5739 $('#prop' + i + '_type').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5740 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5741 source: StarterTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5742 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5743 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5744 width: 120,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5745 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5746 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5747 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5748 $('#prop' + i + '_volume').jqxNumberInput(Spin3dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
5749 $('#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
5750 $('#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
5751 $('#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
5752 }
619
4938909df593 Fixed starter production date tooltip. Upgraded jqwidgets from version 8.1.4 to 9.0.0
Michiel Broek <mbroek@mbse.eu>
parents: 618
diff changeset
5753 $('#starter_type').jqxTooltip({ content: 'starter_type' });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5754 $('#starter_type').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5755 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5756 source: StarterTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5757 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5758 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5759 width: 120,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5760 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5761 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5762 });
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
5763 $('#starter_sg').jqxTooltip({ content: 'Het ideale starter SG moet tussen de 1.030 en 1.040 zijn. Optimaal is 1.037.' });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5764 $('#starter_sg').jqxNumberInput(SGopts);
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
5765 $('#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
5766 $('#starter_viability').jqxNumberInput(Show0dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5767 $('#starter_try').jqxButton({ template: 'primary', width: '100px', height: 23, theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5768
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5769 // Tab 7, Mashing
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5770 $('#mash_name').jqxTooltip({ content: 'De omschrijving van dit maisch profiel.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5771 $('#mash_name').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5772 $('#mash_select').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5773 placeHolder: 'Kies schema:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5774 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5775 source: mashlist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5776 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5777 width: 250,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5778 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5779 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5780 dropDownHeight: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5781 dropDownHorizontalAlignment: 'right'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5782 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5783 $('#mash_select').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5784 if (event.args) {
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
5785 var infused = 0, data, datarecord, rowIDs, rows, i, row, index = event.args.index;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5786 // First delete all current steps
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5787 rowIDs = new Array();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5788 rows = $('#mashGrid').jqxGrid('getdisplayrows');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5789 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5790 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5791 rowIDs.push(row.uid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5792 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5793 $('#mashGrid').jqxGrid('deleterow', rowIDs);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5794 // Then add the new steps
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5795 datarecord = mashlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5796 $('#mash_name').val(datarecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5797 for (i = 0; i < datarecord.steps.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5798 data = datarecord.steps[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5799 row = {};
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5800 row['step_name'] = data.step_name;
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
5801 row['step_type'] = parseInt(data.step_type);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5802 row['step_temp'] = parseFloat(data.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
5803 row['end_temp'] = parseFloat(data.end_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
5804 row['step_time'] = parseFloat(data.step_time);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5805 row['ramp_time'] = parseFloat(data.ramp_time);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5806 row['step_infuse_temp'] = 0.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
5807 row['step_infuse_amount'] = 0.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
5808 if (mash_infuse == 0 && dataRecord.wg_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
5809 mash_infuse = dataRecord.wg_amount;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5810 if (data.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
5811 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
5812 row['step_infuse_amount'] = parseFloat(mash_infuse);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5813 } 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
5814 row['step_infuse_temp'] = 99.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
5815 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5816 }
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
5817 row['step_ph'] = 0.0;
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
5818 row['step_sg'] = 0.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
5819 //console.log(i + ' type: ' + row['step_type'] + ' start infusion: ' + parseFloat(row['step_infuse_amount']) + ' mash_infuse: ' + mash_infuse);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5820 infused += parseFloat(row['step_infuse_amount']);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5821 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
5822 if (mashkg > 0)
740
04c0e444e48e Upgrade mash steps when loading a product. Mash steps Brix input doesn't need wort correction. Added measure data input on the checklist for the first mash step.
Michiel Broek <mbroek@mbse.eu>
parents: 738
diff changeset
5823 row['step_wg_ratio'] = Round(parseFloat(mash_infuse / mashkg), 6);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5824 else
740
04c0e444e48e Upgrade mash steps when loading a product. Mash steps Brix input doesn't need wort correction. Added measure data input on the checklist for the first mash step.
Michiel Broek <mbroek@mbse.eu>
parents: 738
diff changeset
5825 row['step_wg_ratio'] = 0.0;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5826 $('#mashGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5827 }
490
6c9ad1317f0a Recalculate mash after changing mash parameters.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
5828 calcMash();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5829 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5830 });
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
5831 $('#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
5832 $('#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
5833 $('#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
5834 $('#est_mashtime').jqxInput({ theme: theme, width: 70, height: 23 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5835 $('#MashReady').jqxButton({ template: 'success', width: '90px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5836 $('#MashReady').click(function() {
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
5837 calcFermentables();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5838 calcWater();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5839 calcSparge();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5840 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5841 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5842 $('#wstep_name').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5843 $('#wstep_name').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5844 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
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
5845 rowdata.step_name = $('#wstep_name').val();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5846 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5847 $('#wstep_type').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5848 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5849 source: MashStepTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5850 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5851 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5852 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5853 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5854 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5855 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5856 $('#wstep_type').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5857 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5858 var rowdata, i, rows, row, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5859 rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
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
5860 if (rowdata.step_type != index) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5861 rowdata.step_type = index;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5862 $('#wstep_infuse_amount').hide();
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
5863 $('#wstep_infuse_temp').hide();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5864 $('#wstep_pmpt_amount').hide();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5865 $('#wstep_pmpt_temp').hide();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5866 if (index == 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
5867 if (mashRow == 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
5868 $('#wstep_infuse_amount').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5869 $('#wstep_pmpt_amount').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5870 } 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
5871 $('#wstep_infuse_temp').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5872 $('#wstep_pmpt_temp').show();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5873 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5874 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5875 if (index == 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
5876 if (mashRow > 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
5877 rowdata.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
5878 rowdata.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
5879 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5880 if (index == 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
5881 var rowprev = $('#mashGrid').jqxGrid('getrowdata', mashRow-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
5882 rowdata.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
5883 rowdata.step_infuse_amount = decoctionVol(rowdata.step_volume, rowdata.step_temp, rowprev.end_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
5884 console.log('decoction: ' + rowdata.step_infuse_amount + '/' + rowdata.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
5885 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5886 $('#mashGrid').jqxGrid('updaterow', mashRow, 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
5887 mash_infuse = 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
5888 rows = $('#mashGrid').jqxGrid('getrows');
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5889 for (i = 0; i < rows.length; i++) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5890 row = rows[i];
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5891 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
5892 mash_infuse += parseFloat(row.step_infuse_amount);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5893 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5894 calcMash();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5895 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5896 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5897 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5898 $('#wstep_temp').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5899 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
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
5900 if (rowdata.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
5901 var rowprev = $('#mashGrid').jqxGrid('getrowdata', mashRow-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
5902 var a = (dataRecord.eq_tun_weight * dataRecord.eq_tun_specific_heat + rowdata.step_volume * 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
5903 (parseFloat(event.args.value) - rowprev.end_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
5904 var b = SpecificHeatWater * (99 - parseFloat(event.args.value));
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5905 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
5906 rowdata.step_temp = parseFloat(event.args.value);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5907 rowdata.step_infuse_amount = Round(a / b, 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
5908 } 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
5909 rowdata.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
5910 console.log('change temp ' + rowdata.step_temp + ' decoction: ' + rowdata.step_infuse_amount + '/' + rowdata.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
5911 } 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
5912 rowdata.step_temp = parseFloat(event.args.value);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5913 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5914 });
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
5915 $('#wstep_temp,#wend_temp,#wstep_infuse_amount,#wstep_infuse_temp').jqxNumberInput(Spin1dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5916 $('#wend_temp').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5917 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5918 rowdata.end_temp = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5919 });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
5920 $('#wstep_time,#wramp_time').jqxNumberInput(PosInt);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5921 $('#wstep_time').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5922 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5923 rowdata.step_time = parseFloat(event.args.value);
490
6c9ad1317f0a Recalculate mash after changing mash parameters.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
5924 calcMash();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5925 });
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
5926 $('#wstep_ph').jqxNumberInput(Spin2pH);
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
5927 $('#wstep_ph').on('change', function(event) {
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
5928 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
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
5929 rowdata.step_ph = parseFloat(event.args.value);
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
5930 });
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
5931 $('#wstep_sg').jqxNumberInput(SGopts);
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
5932 $('#wstep_sg').on('change', function(event) {
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
5933 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
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
5934 rowdata.step_sg = parseFloat(event.args.value);
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
5935 });
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
5936 $('#wstep_brix').jqxNumberInput(Spin1dec);
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
5937 $('#wstep_brix').on('change', function(event) {
740
04c0e444e48e Upgrade mash steps when loading a product. Mash steps Brix input doesn't need wort correction. Added measure data input on the checklist for the first mash step.
Michiel Broek <mbroek@mbse.eu>
parents: 738
diff changeset
5938 /* Use plato_to_sg at this stage */
04c0e444e48e Upgrade mash steps when loading a product. Mash steps Brix input doesn't need wort correction. Added measure data input on the checklist for the first mash step.
Michiel Broek <mbroek@mbse.eu>
parents: 738
diff changeset
5939 var sg = plato_to_sg(parseFloat(event.args.value));
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
5940 console.log('brix: ' + parseFloat(event.args.value) + ' sg: ' + sg);
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
5941 if (sg > 1.005) {
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
5942 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
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
5943 rowdata.step_sg = sg;
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
5944 $('#wstep_sg').val(sg);
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
5945 }
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
5946 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5947 $('#wramp_time').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5948 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5949 rowdata.ramp_time = parseFloat(event.args.value);
490
6c9ad1317f0a Recalculate mash after changing mash parameters.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
5950 calcMash();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5951 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5952 $('#wstep_infuse_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5953 var row, i, rows, rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5954 rowdata.step_infuse_amount = parseFloat(event.args.value);
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
5955 if (mashRow == 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
5956 rowdata.step_infuse_amount = parseFloat(event.args.value);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5957 mash_infuse = 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
5958 rows = $('#mashGrid').jqxGrid('getrows');
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5959 for (i = 0; i < rows.length; i++) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5960 row = rows[i];
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5961 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
5962 mash_infuse += parseFloat(row.step_infuse_amount);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5963 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5964 if (dataRecord.w2_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
5965 dataRecord.w1_amount = mash_infuse;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5966 $('#w1_amount').val(mash_infuse);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5967 } 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
5968 var w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5969 var w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5970 dataRecord.w1_amount = Round(w1_amount, 3);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5971 dataRecord.w2_amount = Round(w2_amount, 3);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5972 $('#w1_amount').val(dataRecord.w1_amount);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5973 $('#w2_amount').val(dataRecord.w2_amount);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5974 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5975 $('#wg_amount').val(mash_infuse);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5976 console.log('new infuse amount: ' + mash_infuse);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5977 calcWater();
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5978 // calcMash();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5979 }
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
5980 });
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5981 $('#wstep_infuse_temp').on('change', function(event) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5982 var prevdata = $('#mashGrid').jqxGrid('getrowdata', mashRow-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
5983 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5984 rowdata.step_infuse_temp = parseFloat(event.args.value);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
5985 var vol = infusionVol(prevdata.step_volume, mashkg, rowdata.step_infuse_temp, rowdata.step_temp, prevdata.end_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
5986 console.log('new vol: ' + 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
5987 rowdata.step_infuse_amount = 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
5988 $('#wstep_infuse_amount').val(vol);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5989 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5990
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5991 // Tab 8, Water
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5992 $('#tgt_bu').jqxNumberInput(Show2wat);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
5993 $('#tgt_so4_cl,#got_so4_cl').jqxNumberInput(Show1wat);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5994
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5995 // Water source 1
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5996 $('#w1_name').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5997 placeHolder: 'Kies hoofd water:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5998 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5999 source: waterlist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6000 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6001 width: 250,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6002 height: 27,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6003 dropDownWidth: 400,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6004 dropDownHeight: 400
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6005 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6006 $('#w1_name').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6007 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6008 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6009 datarecord = waterlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6010 dataRecord.w1_name = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6011 $('#w1_calcium').val(datarecord.calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6012 dataRecord.w1_calcium = datarecord.calcium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6013 $('#w1_sulfate').val(datarecord.sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6014 dataRecord.w1_sulfate = datarecord.sulfate;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6015 $('#w1_chloride').val(datarecord.chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6016 dataRecord.w1_chloride = datarecord.chloride;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6017 $('#w1_sodium').val(datarecord.sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6018 dataRecord.w1_sodium = datarecord.sodium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6019 $('#w1_magnesium').val(datarecord.magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6020 dataRecord.w1_magnesium = datarecord.magnesium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6021 $('#w1_total_alkalinity').val(datarecord.total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6022 dataRecord.w1_total_alkalinity = datarecord.total_alkalinity;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6023 $('#w1_ph').val(datarecord.ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6024 dataRecord.w1_ph = datarecord.ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6025 $('#w1_cost').val(datarecord.cost);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6026 dataRecord.w1_cost = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6027 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6028 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6029 });
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
6030 $('#w1_amount,#w1_calcium,#w1_magnesium,#w1_sodium,#w1_total_alkalinity,#w1_chloride,#w1_sulfate').jqxNumberInput(Show1wat);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
6031 $('#w1_ph').jqxNumberInput(Show2wat);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6032 // Water source 2
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6033 $('#w2_name').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6034 placeHolder: 'Kies meng water:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6035 theme: theme,
755
509510586665 Added a empty second water source to the dropdown for water 2. When the empty water is selected, all volumes are reset to a single water source. Don't show the second water in the printed recipe and checklist if there is only one water source.
Michiel Broek <mbroek@mbse.eu>
parents: 752
diff changeset
6036 source: water2list,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6037 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6038 width: 250,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6039 height: 27,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6040 dropDownWidth: 400,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6041 dropDownHeight: 400
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6042 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6043 $('#w2_name').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6044 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6045 var datarecord, index = event.args.index;
755
509510586665 Added a empty second water source to the dropdown for water 2. When the empty water is selected, all volumes are reset to a single water source. Don't show the second water in the printed recipe and checklist if there is only one water source.
Michiel Broek <mbroek@mbse.eu>
parents: 752
diff changeset
6046 datarecord = water2list.records[index];
509510586665 Added a empty second water source to the dropdown for water 2. When the empty water is selected, all volumes are reset to a single water source. Don't show the second water in the printed recipe and checklist if there is only one water source.
Michiel Broek <mbroek@mbse.eu>
parents: 752
diff changeset
6047 if (index == 0) {
509510586665 Added a empty second water source to the dropdown for water 2. When the empty water is selected, all volumes are reset to a single water source. Don't show the second water in the printed recipe and checklist if there is only one water source.
Michiel Broek <mbroek@mbse.eu>
parents: 752
diff changeset
6048 dataRecord.w2_amount = 0;
509510586665 Added a empty second water source to the dropdown for water 2. When the empty water is selected, all volumes are reset to a single water source. Don't show the second water in the printed recipe and checklist if there is only one water source.
Michiel Broek <mbroek@mbse.eu>
parents: 752
diff changeset
6049 $('#w2_amount').val(0);
509510586665 Added a empty second water source to the dropdown for water 2. When the empty water is selected, all volumes are reset to a single water source. Don't show the second water in the printed recipe and checklist if there is only one water source.
Michiel Broek <mbroek@mbse.eu>
parents: 752
diff changeset
6050 dataRecord.w1_amount = mash_infuse;
509510586665 Added a empty second water source to the dropdown for water 2. When the empty water is selected, all volumes are reset to a single water source. Don't show the second water in the printed recipe and checklist if there is only one water source.
Michiel Broek <mbroek@mbse.eu>
parents: 752
diff changeset
6051 $('#w1_amount').val(mash_infuse);
509510586665 Added a empty second water source to the dropdown for water 2. When the empty water is selected, all volumes are reset to a single water source. Don't show the second water in the printed recipe and checklist if there is only one water source.
Michiel Broek <mbroek@mbse.eu>
parents: 752
diff changeset
6052 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6053 dataRecord.w2_name = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6054 $('#w2_calcium').val(datarecord.calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6055 dataRecord.w2_calcium = datarecord.calcium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6056 $('#w2_sulfate').val(datarecord.sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6057 dataRecord.w2_sulfate = datarecord.sulfate;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6058 $('#w2_chloride').val(datarecord.chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6059 dataRecord.w2_chloride = datarecord.chloride;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6060 $('#w2_sodium').val(datarecord.sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6061 dataRecord.w2_sodium = datarecord.sodium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6062 $('#w2_magnesium').val(datarecord.magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6063 dataRecord.w2_magnesium = datarecord.magnesium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6064 $('#w2_total_alkalinity').val(datarecord.total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6065 dataRecord.w2_total_alkalinity = datarecord.total_alkalinity;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6066 $('#w2_ph').val(datarecord.ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6067 dataRecord.w2_ph = datarecord.ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6068 $('#w2_cost').val(datarecord.cost);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6069 dataRecord.w2_cost = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6070 $('#w2_amount').jqxNumberInput({ max: 100000, readOnly: false }); // Set high max to enable the spinbuttons.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6071 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6072 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6073 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6074 $('#w2_amount').jqxTooltip({ content: 'De verdeling van het hoofd en meng water. Het totale maisch water volume blijft gelijk.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6075 $('#w2_amount').jqxNumberInput({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6076 inputMode: 'simple', spinMode: 'simple', theme: theme, width: 94, height: 23, min: 0, max: 0, decimalDigits: 1,
612
576128de01e3 Fixed mash infuse amount division
Michiel Broek <mbroek@mbse.eu>
parents: 610
diff changeset
6077 spinButtons: true, spinButtonsStep: 0.1, readOnly: true
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6078 });
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
6079 $('#w2_calcium,#w2_magnesium,#w2_sodium,#w2_total_alkalinity,#w2_chloride,#w2_sulfate').jqxNumberInput(Show1wat);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
6080 $('#w2_ph').jqxNumberInput(Show2wat);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6081 // Water mixed
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
6082 $('#wg_amount,#wg_calcium,#wg_magnesium,#wg_sodium,#wg_total_alkalinity,#wg_chloride,#wg_sulfate').jqxNumberInput(Show1wat);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
6083 $('#wg_ph').jqxNumberInput(Show2wat);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6084 // Water treated
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6085 $('#wb_calcium').jqxTooltip({ content: 'De ideale hoeveelheid Calcium is tussen 40 en 150.'});
607
0efba09a694c Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents: 602
diff changeset
6086 $('#wb_magnesium').jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is tusse 10 en 30.'});
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6087 $('#wb_sodium').jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6088 $('#wb_chloride').jqxTooltip({ content: 'De ideale hoeveelheid Chloride is tussen 50 en 100.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6089 $('#wb_sulfate').jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is tussen 50 en 350.'});
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
6090 $('#wb_calcium,#wb_magnesium,#wb_sodium,#wb_total_alkalinity,#wb_chloride,#wb_sulfate').jqxNumberInput(Show1wat);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
6091 $('#wb_ph').jqxNumberInput(Show2wat);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6092 // Water target profile
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6093 $('#pr_name').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6094 placeHolder: 'Kies doel profiel:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6095 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6096 source: waterprofiles,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6097 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6098 width: 250,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6099 height: 27,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6100 dropDownWidth: 400,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6101 dropDownHeight: 300
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6102 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6103 $('#pr_name').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6104 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6105 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6106 datarecord = waterprofiles.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6107 $('#pr_calcium').val(datarecord.calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6108 $('#pr_sulfate').val(datarecord.sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6109 $('#pr_chloride').val(datarecord.chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6110 $('#pr_sodium').val(datarecord.sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6111 $('#pr_magnesium').val(datarecord.magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6112 $('#pr_total_alkalinity').val(datarecord.total_alkalinity);
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
6113 calcWater();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6114 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6115 });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6116 $('#pr_calcium,#pr_magnesium,#pr_sodium,#pr_total_alkalinity,#pr_chloride,#pr_sulfate').jqxNumberInput(Show1wat);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6117
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6118 // Water agents
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6119 $('#wa_cacl2').jqxTooltip({ content: 'Voor het maken van een ander waterprofiel. Voegt calcium en chloride toe. Voor het verbeteren van zoetere bieren.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6120 $('#wa_caso4').jqxTooltip({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6121 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
6122 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6123 $('#wa_mgso4').jqxTooltip({ content: 'Epsom zout. Voor het maken van een ander waterprofiel. Voegt magnesium en sulfaat toe. Gebruik spaarzaam!' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6124 $('#wa_nacl').jqxTooltip({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6125 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
6126 '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
6127 });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6128 $('#wa_cacl2,#wa_caso4,#wa_mgso4,#wa_nacl').jqxNumberInput(Spin1dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6129 $('#mash_ph').jqxTooltip({ content: 'Maisch pH tussen 5.2 en 5.6. Gebruik 5.2 voor lichte en 5.5 voor donkere bieren.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6130 $('#mash_ph').jqxNumberInput(SpinpH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6131 $('#calc_acid').jqxCheckBox({ theme: theme, width: 120, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6132 $('#wa_base_name').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6133 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6134 source: BaseTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6135 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6136 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6137 width: 170,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6138 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6139 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6140 });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
6141 $('#wa_base,#wa_acid').jqxNumberInput(Spin2dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6142 $('#wa_base').jqxNumberInput({ symbol: ' gr', symbolPosition: 'right' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6143 $('#wa_acid_name').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6144 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6145 source: AcidTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6146 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6147 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6148 width: 170,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6149 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6150 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6151 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6152 $('#wa_acid').jqxNumberInput({ symbol: ' ml', symbolPosition: 'right' });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
6153 $('#wa_acid_perc,#sparge_acid_perc').jqxNumberInput(Perc0);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6154 $('#wa_acid_perc').jqxNumberInput({ width: 70, symbol: '%', symbolPosition: 'right' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6155 // Sparge water
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6156 $('#sparge_temp,#sparge_volume').jqxNumberInput(Spin1dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6157 $('#sparge_ph').jqxNumberInput(SpinpH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6158 $('#sparge_source').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6159 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6160 source: SpargeSourceAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6161 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6162 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6163 width: 110,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6164 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6165 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6166 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6167 $('#sparge_acid_amount').jqxNumberInput(Spin2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6168 $('#sparge_acid_amount').jqxNumberInput({ spinButtons: false, readOnly: true, symbol: ' ml', symbolPosition: 'right' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6169 $('#sparge_acid_type').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6170 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6171 source: AcidTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6172 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6173 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6174 width: 110,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6175 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6176 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6177 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6178 $('#sparge_acid_perc').jqxNumberInput({ symbol: '%', symbolPosition: 'right' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6179
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6180 // Tab 9, Brewday
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6181 $('#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
6182 $('#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
6183 $('#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
6184 $('#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
6185 $('#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
6186 $('#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
6187 $('#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
6188 $('#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
6189 $('#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
6190 $('#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
6191 $('#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
6192 $('#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
6193 $('#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
6194 $('#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
6195 $('#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
6196 $('#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
6197 $('#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
6198 $('#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
6199 $('#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
6200 $('#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
6201 $('#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
6202 $('#brew_date_start,#brew_date_end').jqxDateTimeInput(DateTimeopts);
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
6203 $('#brew_date_start,#brew_date_end').on('close', function(event) { calcStage(); });
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
6204 $('#est_mash_ph').jqxNumberInput(Show2wat);
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
6205 $('#brew_mash_ph,#brew_preboil_ph,#brew_aboil_ph').jqxNumberInput(Spin2pH);
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
6206 $('#brew_mash_sg').on('valueChanged', function() { calcMashEfficiency(); });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6207 $('#brew_preboil_sg').on('valueChanged', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6208 dataRecord.brew_preboil_sg = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6209 calcEfficiencyBeforeBoil();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6210 });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6211 $('#brew_mash_sg,#brew_preboil_sg,#brew_aboil_sg').jqxNumberInput(SGopts);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6212 $('#brew_aboil_sg').on('valueChanged', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6213 dataRecord.brew_aboil_sg = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6214 calcEfficiencyAfterBoil();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6215 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6216 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6217 });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6218 $('#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
6219 $('#brew_mash_efficiency').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6220 $('#brew_preboil_volume').on('valueChanged', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6221 dataRecord.brew_preboil_volume = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6222 calcEfficiencyBeforeBoil();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6223 });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6224 $('#brew_preboil_volume,#brew_aboil_volume').jqxNumberInput(Spin1dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6225 $('#brew_aboil_volume').on('valueChanged', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6226 dataRecord.brew_aboil_volume = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6227 calcEfficiencyAfterBoil();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6228 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6229 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6230 });
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
6231 $('#ketel_volume').jqxNumberInput(Show1dec);
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
6232 $('#ketel_cm').jqxNumberInput(Spin1dec);
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
6233 $('#ketel_cm').on('change', function(event) {
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
6234 k_cm = parseFloat(event.args.value);
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
6235 k_vol = kettle_vol(k_cm, dataRecord.eq_kettle_volume, dataRecord.eq_kettle_height);
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
6236 $('#ketel_volume').val(k_vol);
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
6237 });
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
6238 $('#volumeReady').jqxButton({ template: 'success', width: '90px', theme: theme });
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
6239 $('#volumeReady').click(function() {
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
6240 /* Is it pre or after boil */
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
6241 console.log('volumeReady ' + k_what + ' volume: ' + Round(k_vol, 1));
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
6242 if (k_what == 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
6243 dataRecord.brew_preboil_volume = Round(k_vol, 1);
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
6244 $('#brew_preboil_volume').val(Round(k_vol, 1));
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
6245 } else if (k_what == 1) {
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
6246 dataRecord.brew_aboil_volume = Round(k_vol, 1);
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
6247 $('#brew_aboil_volume').val(Round(k_vol, 1));
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
6248 }
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
6249 });
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
6250 $('#but_pre_boil').jqxButton({ template: 'success', width: '23px', height: 23, theme: theme });
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
6251 $('#but_pre_boil').bind('click', function() {
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
6252 /* If we already have measured a value, use that. Else use the estimated value. */
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
6253 if (dataRecord.brew_preboil_volume > 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
6254 k_cm = kettle_cm(dataRecord.brew_preboil_volume, dataRecord.eq_kettle_volume, dataRecord.eq_kettle_height);
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
6255 else
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
6256 k_cm = kettle_cm(dataRecord.boil_size * 1.04, dataRecord.eq_kettle_volume, dataRecord.eq_kettle_height);
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
6257 k_vol = kettle_vol(k_cm, dataRecord.eq_kettle_volume, dataRecord.eq_kettle_height);
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
6258 k_what = 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
6259 $('#ketel_cm').val(k_cm);
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
6260 $('#ketel_volume').val(k_vol);
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
6261 $('#volumeWindow').jqxWindow('open');
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
6262 });
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
6263 $('#but_after_boil').jqxButton({ template: 'success', width: 23, height: 23, theme: theme });
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
6264 $('#but_after_boil').bind('click', function() {
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
6265 if (dataRecord.brew_aboil_volume > 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
6266 k_cm = kettle_cm(dataRecord.brew_aboil_volume, dataRecord.eq_kettle_volume, dataRecord.eq_kettle_height);
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
6267 else
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
6268 k_cm = kettle_cm(dataRecord.batch_size * 1.04, dataRecord.eq_kettle_volume, dataRecord.eq_kettle_height);
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
6269 k_vol = kettle_vol(k_cm, dataRecord.eq_kettle_volume, dataRecord.eq_kettle_height);
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
6270 k_what = 1;
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
6271 $('#ketel_cm').val(k_cm);
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
6272 $('#ketel_volume').val(k_vol);
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
6273 $('#volumeWindow').jqxWindow('open');
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
6274 });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6275 $('#est_pre_vol,#est_a_vol').jqxNumberInput(Show1wat);
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6276 $('#brew_preboil_efficiency,#brew_aboil_efficiency,#brew_sparge_temperature,#brew_sparge_volume,#brew_sparge_est').jqxNumberInput(Show1dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6277 $('#brew_cooling_to').jqxNumberInput(Spin1dec);
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
6278 $('#brew_sparge_ph').jqxNumberInput(Spin2pH);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6279 $('#brew_cooling_method').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6280 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6281 source: CoolingTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6282 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6283 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6284 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6285 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6286 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6287 });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
6288 $('#brew_cooling_time,#brew_whirlpool9,#brew_whirlpool7,#brew_whirlpool6,#brew_whirlpool2,#brew_aeration_time,#brew_aeration_speed').jqxNumberInput(PosInt);
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
6289 $('#brew_cooling_time,#brew_aeration_time,#brew_aeration_speed').jqxNumberInput({ max: 1440 });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6290 $('#brew_whirlpool9,#brew_whirlpool7,#brew_whirlpool6,#brew_whirlpool2').jqxNumberInput({ max: 120 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6291 $('#brew_aeration_type').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6292 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6293 source: AerationTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6294 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6295 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6296 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6297 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6298 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6299 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6300 $('#brew_fermenter_volume').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6301 $('#brew_fermenter_sg').jqxNumberInput(Show3dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6302 $('#brew_fermenter_extrawater,#brew_fermenter_tcloss').jqxNumberInput(Spin1dec);
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6303 $('#brew_fermenter_ibu,#brew_fermenter_color').jqxNumberInput(Show0dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6304 $('#BLog').jqxButton({ template: 'info', width: '150px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6305 $('#BLog').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6306 // Open log in a new tab.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6307 window.open('log_brew.php?code=' + dataRecord.code + '&name=' + dataRecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6308 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6309
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6310 // Tab 10, Fermentation
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6311 // Note, fermentation temps changes must do calcCarbonation()
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6312 $('#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
6313 $('#primary_start_temp').jqxTooltip({ content: 'De begintemperatuur van de hoofdvergisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6314 $('#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
6315 $('#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
6316 $('#primary_end_sg').jqxTooltip({ content: 'Het gemeten SG aan het eind van de hoofdvergisting.' });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
6317 $('#primary_end_brix,#secondary_end_brix,#final_brix').jqxTooltip({ content: 'Hulpfinctie: de afgelezen &deg;Brix RI waarde met een refractometer.' });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6318 $('#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
6319 $('#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
6320 $('#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
6321 $('#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
6322 $('#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
6323 $('#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
6324
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
6325 $('#primary_end_sg,#secondary_end_sg').jqxNumberInput(SGopts);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6326 $('#primary_end_date,#secondary_end_date').jqxDateTimeInput(Dateopts);
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6327 $('#primary_end_date,#secondary_end_date').on('close', function(event) { calcStage(); });
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6328 $('#primary_start_temp,#primary_max_temp,#primary_end_temp,#secondary_temp,#tertiary_temp').jqxNumberInput(YeastT);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6329 $('#fg').jqxNumberInput(Spin3dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6330 $('#brew_fermenter_sg2,#est_fg3').jqxNumberInput(Show3dec);
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6331 $('#primary_end_brix,#secondary_end_brix,#final_brix').jqxNumberInput(Spin1dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6332 $('#final_abv').jqxNumberInput(Show2dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6333 $('#primary_svg,#secondary_svg,#final_svg').jqxNumberInput(Show1dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6334 $('#FLog').jqxButton({ template: 'info', width: '150px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6335 $('#FLog').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6336 // Open log in a new tab.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6337 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
6338 });
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
6339 $('#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
6340 $('#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
6341 // 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
6342 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
6343 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6344
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6345 // Tab 11, Packaging
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6346 // 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
6347 $('#package_date').jqxTooltip({ content: 'De verpakkings datum van dit bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6348 $('#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
6349 $('#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
6350 $('#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
6351 $('#package_infuse_notes').jqxTooltip({ content: 'Omschrijving van de extra toevoeging.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6352 $('#package_abv').jqxTooltip({ content: 'De uiteindelijke hoeveelheid alcohol volume %.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6353 $('#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
6354 $('#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
6355 $('#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
6356 $('#bottle_amount').jqxTooltip({ content: 'De totale hoeveelheid te bottelen bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6357 $('#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
6358 $('#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
6359 $('#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
6360 $('#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
6361 $('#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
6362 $('#package_date').jqxDateTimeInput(Dateopts);
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
6363 $('#package_date').on('close', function(event) { calcStage(); });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
6364 $('#package_infuse_amount').jqxNumberInput(Spin3dec);
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
6365 $('#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
6366 $('#package_abv').jqxNumberInput(Show2dec);
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
6367 $('#package_ph').jqxNumberInput(SpinpH);
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
6368 $('#st_carb_min2,#st_carb_max2').jqxNumberInput(Smal1dec);
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
6369 $('#package_volume,#package_infuse_abv,#bottle_amount,#keg_amount').jqxNumberInput(Spin1dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6370 $('#bottle_carbonation,#keg_carbonation').jqxNumberInput(Spin2dec);
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6371 $('#bottle_carbonation,#keg_carbonation').jqxNumberInput({ max: 5 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6372 $('#bottle_priming_sugar').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6373 placeHolder: 'Kies suiker:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6374 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6375 source: fermentablesugars,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6376 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6377 width: 200,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6378 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6379 dropDownWidth: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6380 dropDownHeight: 400
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6381 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6382 $('#bottle_priming_sugar').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6383 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6384 var rowID, index, editrow = -1, datarecord, rows, i, row = {};
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6385 index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6386 datarecord = fermentablesugars.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6387 rows = $('#fermentableGrid').jqxGrid('getrows');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6388 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6389 if (rows[i].f_added == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6390 editrow = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6391 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6392 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6393 row['f_name'] = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6394 row['f_origin'] = datarecord.origin;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6395 row['f_supplier'] = datarecord.supplier;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6396 row['f_amount'] = parseFloat($('#bottle_priming_total').jqxNumberInput('decimal')) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6397 row['f_cost'] = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6398 row['f_type'] = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6399 row['f_yield'] = datarecord.yield;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6400 row['f_color'] = datarecord.color;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6401 row['f_coarse_fine_diff'] = datarecord.coarse_fine_diff;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6402 row['f_moisture'] = datarecord.moisture;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6403 row['f_diastatic_power'] = datarecord.diastatic_power;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6404 row['f_protein'] = datarecord.protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6405 row['f_max_in_batch'] = datarecord.max_in_batch;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6406 row['f_graintype'] = datarecord.graintype;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6407 row['f_added'] = 4;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6408 row['f_dissolved_protein'] = datarecord.dissolved_protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6409 row['f_recommend_mash'] = datarecord.recommend_mash;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6410 row['f_add_after_boil'] = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6411 row['f_adjust_to_total_100'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6412 row['f_percentage'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6413 row['f_di_ph'] = datarecord.di_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6414 row['f_acid_to_ph_57'] = datarecord.acid_to_ph_57;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6415 row['f_inventory'] = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6416 if (editrow >= 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6417 rowID = $('#fermentableGrid').jqxGrid('getrowid', editrow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6418 $('#fermentableGrid').jqxGrid('updaterow', rowID, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6419 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6420 $('#fermentableGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6421 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6422 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6423 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6424 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6425 $('#keg_priming_sugar').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6426 placeHolder: 'Kies suiker:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6427 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6428 source: fermentablesugars,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6429 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6430 width: 200,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6431 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6432 dropDownWidth: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6433 dropDownHeight: 400
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6434 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6435 $('#keg_priming_sugar').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6436 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6437 var rowID, index, editrow = -1, datarecord, rows, i, row = {};
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6438 index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6439 datarecord = fermentablesugars.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6440 rows = $('#fermentableGrid').jqxGrid('getrows');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6441 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6442 if (rows[i].f_added == 5) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6443 editrow = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6444 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6445 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6446 row['f_name'] = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6447 row['f_origin'] = datarecord.origin;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6448 row['f_supplier'] = datarecord.supplier;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6449 row['f_amount'] = parseFloat($('#keg_priming_total').jqxNumberInput('decimal')) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6450 row['f_cost'] = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6451 row['f_type'] = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6452 row['f_yield'] = datarecord.yield;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6453 row['f_color'] = datarecord.color;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6454 row['f_coarse_fine_diff'] = datarecord.coarse_fine_diff;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6455 row['f_moisture'] = datarecord.moisture;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6456 row['f_diastatic_power'] = datarecord.diastatic_power;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6457 row['f_protein'] = datarecord.protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6458 row['f_max_in_batch'] = datarecord.max_in_batch;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6459 row['f_graintype'] = datarecord.graintype;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6460 row['f_added'] = 5;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6461 row['f_dissolved_protein'] = datarecord.dissolved_protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6462 row['f_recommend_mash'] = datarecord.recommend_mash;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6463 row['f_add_after_boil'] = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6464 row['f_adjust_to_total_100'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6465 row['f_percentage'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6466 row['f_di_ph'] = datarecord.di_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6467 row['f_acid_to_ph_57'] = datarecord.acid_to_ph_57;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6468 row['f_inventory'] = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6469 if (editrow >= 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6470 rowID = $('#fermentableGrid').jqxGrid('getrowid', editrow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6471 $('#fermentableGrid').jqxGrid('updaterow', rowID, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6472 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6473 $('#fermentableGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6474 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6475 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6476 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6477 });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6478 $('#bottle_priming_water,#keg_priming_water').jqxNumberInput(Spin3dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6479 $('#keg_forced_carb').jqxCheckBox({ theme: theme, width: 120, height: 23 });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6480 $('#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
6481 $('#bottle_abv,#keg_abv').jqxNumberInput(Show2dec);
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6482 $('#bottle_carbonation_temp,#keg_carbonation_temp').jqxNumberInput(YeastT);
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
6483 $('#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
6484 $('#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
6485 // 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
6486 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
6487 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6488
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6489 // Tab 12, Tasting
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6490 $('#taste_date').jqxTooltip({ content: 'De proef datum van dit bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6491 $('#taste_date').jqxDateTimeInput(Dateopts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6492 $('#taste_date').on('close', function(event) { calcStage(); });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6493 $('#taste_rate').jqxTooltip({ content: 'Het cijfer voor dit bier van 1 tot 10.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6494 $('#taste_rate').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6495 $('#taste_rate').jqxNumberInput({ max: 10 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6496 $('#taste_color').jqxTooltip({ content: 'De kleur van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6497 $('#taste_transparency').jqxTooltip({ content: 'De helderheid van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6498 $('#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
6499 $('#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
6500 $('#taste_aroma').jqxTooltip({ content: 'Het aroma van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6501 $('#taste_taste').jqxTooltip({ content: 'De smaak van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6502 $('#taste_aftertaste').jqxTooltip({ content: 'De nasmaak van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6503 $('#taste_mouthfeel').jqxTooltip({ content: 'Het mondgevoelvan het bier.' });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
6504 $('#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
6505 $('#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
6506 $('#taste_notes').jqxInput({ theme: theme, width: 960, height: 100 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6507
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6508 $('#jqxTabs').jqxTabs({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6509 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6510 width: 1280,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6511 height: 660,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6512 autoHeight: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6513 position: 'top'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6514 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6515
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6516 // Buttons below
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6517 $('#Export').jqxButton({ template: 'info', width: '80px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6518 $('#Export').bind('click', function() {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
6519 saveRecord(0);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6520 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6521
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6522 $('#Delete').jqxButton({ template: 'danger', width: '80px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6523 $('#Delete').bind('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6524 // Open a popup to confirm this action.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6525 $('#eventWindow').jqxWindow('open');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6526 $('#delOk').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6527 var data = 'delete=true&' + $.param({ uuid: dataRecord.uuid });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6528 $.ajax({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6529 dataType: 'json',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6530 url: url,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6531 cache: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6532 data: data,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6533 type: 'POST',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6534 success: function(data, status, xhr) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6535 // delete command is executed.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6536 window.location.href = my_return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6537 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6538 error: function(jqXHR, textStatus, errorThrown) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6539 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6540 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6541 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6542 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6543
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6544 $('#Cancel').jqxButton({ template: 'primary', width: '80px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6545 $('#Cancel').bind('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6546 window.location.href = my_return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6547 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6548
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6549 $('#Save').jqxButton({ template: 'success', width: '80px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6550 $('#Save').bind('click', function() {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
6551 saveRecord(1);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6552 });
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
6553 createPopupElements();
111
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6554 });
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6555

mercurial