www/js/prod_edit.js

changeset 438
61436d428454
parent 433
c2d42c5ae51b
child 439
b72478cd2c18
equal deleted inserted replaced
437:265e3d50d3ee 438:61436d428454
19 * along with ThermFerm; see the file COPYING. If not, write to the Free 19 * along with ThermFerm; see the file COPYING. If not, write to the Free
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *****************************************************************************/ 21 *****************************************************************************/
22 22
23 23
24 function createDelElements() { 24 function createDelElements(){
25 25 $('#eventWindow').jqxWindow({
26 $('#eventWindow').jqxWindow({ 26 theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$('#delOk'),cancelButton:$('#delCancel'),
27 theme: theme, 27 initContent:function(){
28 position: { x: 490, y: 210 }, 28 $('#delOk').jqxButton({template:"danger",width:'65px',theme:theme});
29 width: 300, 29 $('#delCancel').jqxButton({template:"success",width:'65px',theme:theme});
30 height: 175, 30 $('#delCancel').focus();}
31 resizable: false, 31 });
32 isModal: true, 32 $('#eventWindow').jqxWindow('hide');
33 modalOpacity: 0.4,
34 okButton: $('#delOk'),
35 cancelButton: $('#delCancel'),
36 initContent: function () {
37 $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme });
38 $('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme });
39 $('#delCancel').focus();
40 }
41 });
42 $('#eventWindow').jqxWindow('hide');
43 } 33 }
44 34
45 35
46 36
47 $(document).ready(function () { 37 $(document).ready(function () {
101 * Remove the top menu so that we MUST use the buttons to leave the editor. 91 * Remove the top menu so that we MUST use the buttons to leave the editor.
102 */ 92 */
103 $('#jqxMenu').jqxMenu('destroy'); 93 $('#jqxMenu').jqxMenu('destroy');
104 94
105 console.log("record:" + my_record + " return:" + my_return + " theme:" + theme); 95 console.log("record:" + my_record + " return:" + my_return + " theme:" + theme);
106 $("#jqxLoader").jqxLoader({ 96 $("#jqxLoader").jqxLoader({width:250,height:150,isModal:true,text:"Laden product ...",theme:theme});
107 width: 250,
108 height: 150,
109 isModal: true,
110 text: "Laden product ...",
111 theme: theme
112 });
113 97
114 function calcSupplies() { 98 function calcSupplies() {
115
116 if (dataRecord.inventory_reduced > 6) { 99 if (dataRecord.inventory_reduced > 6) {
117 $("#ok_pmpt").hide(); 100 $("#ok_pmpt").hide();
118 return; 101 return;
119 } 102 }
120 if (ok_fermentables && ok_hops && ok_miscs && ok_yeasts && ok_waters) 103 if (ok_fermentables && ok_hops && ok_miscs && ok_yeasts && ok_waters)
249 } 232 }
250 } 233 }
251 fermentableInit = 0; 234 fermentableInit = 0;
252 $("#ferm_lintner").val(Math.round(parseFloat(lintner / mashkg))); 235 $("#ferm_lintner").val(Math.round(parseFloat(lintner / mashkg)));
253 $("#mash_kg").val(mashkg); 236 $("#mash_kg").val(mashkg);
254 console.log("calcFermentables() supplies:"+ok_fermentables); 237 console.log("calcFermentables() supplies:"+ok_fermentables+" moutsuiker:"+sugarsm+"/"+sugarsf);
255 to_100 = my_100; 238 to_100 = my_100;
256 if (to_100) { 239 if (to_100) {
257 $("#wf_amount").jqxNumberInput({ width: 90, readOnly: true, spinButtons: false }); 240 $("#wf_amount").jqxNumberInput({ width: 90, readOnly: true, spinButtons: false });
258 } else { 241 } else {
259 $("#wf_amount").jqxNumberInput({ width: 110, readOnly: false, spinButtons: true }); 242 $("#wf_amount").jqxNumberInput({ width: 110, readOnly: false, spinButtons: true });
2539 }); 2522 });
2540 $("#primary_end_brix").on('change', function (event) { 2523 $("#primary_end_brix").on('change', function (event) {
2541 // Brix reading from refractometer RI 2524 // Brix reading from refractometer RI
2542 if (dataRecord.brew_fermenter_sg >= 1.020) { 2525 if (dataRecord.brew_fermenter_sg >= 1.020) {
2543 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg); 2526 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg);
2544 FBrix = parseFloat(event.args.value) / my_brix_correction; 2527 FBrix = parseFloat(event.args.value);
2545 // http://seanterrill.com/2011/04/07/refractometer-fg-results/ 2528 // http://seanterrill.com/2011/04/07/refractometer-fg-results/
2546 var FG = 1.0000 - 0.0044993 * OBrix + 0.0117741 * FBrix + 2529 // var FG = 1.0000 - 0.0044993 * OBrix + 0.0117741 * FBrix +
2547 0.000275806 * (OBrix * OBrix) - 0.00127169 * (FBrix * FBrix) - 2530 // 0.000275806 * (OBrix * OBrix) - 0.00127169 * (FBrix * FBrix) -
2548 0.00000727999 * Math.pow(OBrix, 3) + 0.0000632929 * Math.pow(FBrix, 3); 2531 // 0.00000727999 * Math.pow(OBrix, 3) + 0.0000632929 * Math.pow(FBrix, 3);
2549 // var FG = 1.0000 - 0.00085683 * OBrix + 0.0034941 * FBrix; 2532 // var FG = 1.0000 - 0.00085683 * OBrix + 0.0034941 * FBrix;
2550 // Brouwhulp 2533 // Brouwhulp
2534 var FG = 1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) -
2535 0.000000034 * Math.pow(OBrix, 3) + 0.00574 * (FBrix) +
2536 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3);
2551 // var FG = ((1.001843 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) 2537 // var FG = ((1.001843 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix)
2552 // - 0.000000034 * Math.pow(OBrix, 3) + 0.00574 * (FBrix) 2538 // - 0.000000034 * Math.pow(OBrix, 3) + 0.00574 * (FBrix)
2553 // + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3)) 2539 // + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3))
2554 // + (1.313454) * 0.001); 2540 // + (1.313454) * 0.001);
2555 console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG); 2541 console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG);
2556 if (FG > 1.00001) { 2542 if (FBrix > 0.05) {
2557 $("#primary_end_sg").val(FG); 2543 $("#primary_end_sg").val(FG);
2558 dataRecord.primary_end_sg = FG; 2544 dataRecord.primary_end_sg = FG;
2559 } 2545 }
2560 calcFermentation(); 2546 calcFermentation();
2561 } 2547 }
2562 }); 2548 });
2563 $("#final_brix").on('change', function (event) { 2549 $("#final_brix").on('change', function (event) {
2564 // Brix reading from refractometer RI 2550 // Brix reading from refractometer RI
2565 if (dataRecord.brew_fermenter_sg >= 1.020) { 2551 if (dataRecord.brew_fermenter_sg >= 1.020) {
2566 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg); 2552 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg);
2567 FBrix = parseFloat(event.args.value) / my_brix_correction; 2553 FBrix = parseFloat(event.args.value);
2568 var FG = 1.0000 - 0.0044993 * OBrix + 0.0117741 * FBrix + 2554 // http://seanterrill.com/2011/04/07/refractometer-fg-results/
2569 0.000275806 * (OBrix * OBrix) - 0.00127169 * (FBrix * FBrix) - 2555 // var FG = 1.0000 - 0.0044993 * OBrix + 0.0117741 * FBrix +
2570 0.00000727999 * Math.pow(OBrix, 3) + 0.0000632929 * Math.pow(FBrix, 3); 2556 // 0.000275806 * (OBrix * OBrix) - 0.00127169 * (FBrix * FBrix) -
2557 // 0.00000727999 * Math.pow(OBrix, 3) + 0.0000632929 * Math.pow(FBrix, 3);
2558 // Brouwhulp BrixToFG()
2559 var FG = 1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) -
2560 0.000000034 * Math.pow(OBrix, 3) + 0.00574 * (FBrix) +
2561 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3);
2562 // Ook brouwhulp SGFerm() maar is niet in gebruik.
2563 // var FG = ((1.001843 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix)
2564 // - 0.000000034 * Math.pow(OBrix, 3) + 0.00574 * (FBrix)
2565 // + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3))
2566 // + (1.313454) * 0.001);
2571 console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG); 2567 console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG);
2572 if (FG > 1.00001) { 2568 if (FBrix > 0.05) {
2573 $("#fg").val(FG); 2569 $("#fg").val(FG);
2574 dataRecord.fg = FG; 2570 dataRecord.fg = FG;
2575 } 2571 }
2576 calcFermentation(); 2572 calcFermentation();
2577 } 2573 }

mercurial