www/js/rec_edit.js

changeset 220
14e349ff2a10
parent 175
da16371538c3
child 221
a8aabb63fbcc
equal deleted inserted replaced
219:4c21eabb3c0e 220:14e349ff2a10
72 var MMNaHCO3 = 84.007; 72 var MMNaHCO3 = 84.007;
73 var MMNa2CO3 = 105.996; 73 var MMNa2CO3 = 105.996;
74 var MMNaCl = 58.443; 74 var MMNaCl = 58.443;
75 var MMCaOH2 = 74.06268; 75 var MMCaOH2 = 74.06268;
76 76
77 var fermentableRow = 0;
78 var fermentableData = {};
79 var hopRow = 0;
80 var hopData = {};
81 var miscRow = 0;
82 var miscData = {};
83 var yeastRow = 0;
84 var yeastData = {};
85
77 console.log("record:" + my_record + " return:" + my_return + " theme:" + theme); 86 console.log("record:" + my_record + " return:" + my_return + " theme:" + theme);
78 $("#jqxLoader").jqxLoader({ 87 $("#jqxLoader").jqxLoader({
79 width: 250, 88 width: 250,
80 height: 150, 89 height: 150,
81 isModal: true, 90 isModal: true,
83 theme: theme 92 theme: theme
84 }); 93 });
85 94
86 function setReadonly(ro) { 95 function setReadonly(ro) {
87 var rw = ! ro; 96 var rw = ! ro;
88 var w100 = 100; 97 var w100 = 110;
89 var w80 = 80; 98 var w80 = 80;
90 if (ro) { // jqxNumberInput width -20 for no spinbuttons 99 if (ro) { // jqxNumberInput width -20 for no spinbuttons
91 w100 = 80; 100 w100 = 90;
92 w80 = 60; 101 w80 = 60;
93 } 102 }
94 $("#batch_size").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 }); 103 $("#batch_size").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
95 $("#boil_size").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 }); 104 $("#boil_size").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
96 $("#boil_time").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 }); 105 $("#boil_time").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
97 $("#efficiency").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 }); 106 $("#efficiency").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
98 $("#est_og").jqxNumberInput({ spinButtons: rw, readOnly: ro }); 107 $("#est_og").jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 });
108 // id="st_fg_min" margin-left 15/35 maken
99 $("#type").jqxDropDownList({ disabled: ro }); 109 $("#type").jqxDropDownList({ disabled: ro });
100 $("#styleSelect").jqxDropDownList({ disabled: ro }); 110 $("#styleSelect").jqxDropDownList({ disabled: ro });
101 $("#color_method").jqxDropDownList({ disabled: ro }); 111 $("#color_method").jqxDropDownList({ disabled: ro });
102 $("#ibu_method").jqxDropDownList({ disabled: ro }); 112 $("#ibu_method").jqxDropDownList({ disabled: ro });
103 $("#Delete").jqxButton({ disabled: ro }); 113 $("#Delete").jqxButton({ disabled: ro });
155 var rows = $('#fermentableGrid').jqxGrid('getrows'); 165 var rows = $('#fermentableGrid').jqxGrid('getrows');
156 for (var i = 0; i < rows.length; i++) { 166 for (var i = 0; i < rows.length; i++) {
157 var row = rows[i]; 167 var row = rows[i];
158 if (row.f_adjust_to_total_100) 168 if (row.f_adjust_to_total_100)
159 my_100 = true; 169 my_100 = true;
160 if (row.f_type == "Sugar") 170 if (row.f_type == 1) // Sugar
161 psugar += row.f_percentage; 171 psugar += row.f_percentage;
162 if (row.f_graintype == "Crystal") 172 if (row.f_graintype == 2) // Crystal
163 pcara += row.f_percentage; 173 pcara += row.f_percentage;
164 var d = row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100); 174 var d = row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100);
165 if (row.f_added == "Mash") { 175 if (row.f_added == 0) { // Mash
166 d = parseFloat(dataRecord.efficiency) / 100 * d; 176 d = parseFloat(dataRecord.efficiency) / 100 * d;
167 sugarsm += d; 177 sugarsm += d;
168 mashkg += row.f_amount; 178 mashkg += row.f_amount;
169 } 179 }
170 sugarsf += d; 180 sugarsf += d;
171 colorw += row.f_amount * ebc_to_srm(row.f_color) / parseFloat(dataRecord.batch_size) * 8.34436; 181 colorw += row.f_amount * ebc_to_srm(row.f_color) / parseFloat(dataRecord.batch_size) * 8.34436;
172 } 182 }
173 to_100 = my_100; 183 to_100 = my_100;
184 if (to_100) {
185 $("#wf_amount").jqxNumberInput({ width: 90, readOnly: true, spinButtons: false });
186 } else {
187 $("#wf_amount").jqxNumberInput({ width: 110, readOnly: false, spinButtons: true });
188 }
174 var est_og = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size)); 189 var est_og = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size));
175 $('#est_og').val(est_og); 190 $('#est_og').val(est_og);
176 $('#est_og2').val(est_og); 191 $('#est_og2').val(est_og);
177 preboil_sg = estimate_sg(sugarsm, dataRecord.boil_size); 192 preboil_sg = estimate_sg(sugarsm, dataRecord.boil_size);
178 var color = kw_to_ebc(dataRecord.color_method, colorw); 193 var color = kw_to_ebc(dataRecord.color_method, colorw);
189 }; 204 };
190 205
191 function hopFlavourContribution(bt, vol, use, amount) { 206 function hopFlavourContribution(bt, vol, use, amount) {
192 var result; 207 var result;
193 208
194 if ((use == "First Wort") || (use == "First wort")) { 209 if (use == 1) { // First wort
195 result = 0.15; // assume 15% flavourcontribution for fwh 210 result = 0.15; // assume 15% flavourcontribution for fwh
196 } else if (bt > 50) { 211 } else if (bt > 50) {
197 result = 0.10; // assume 10% flavourcontribution as a minimum 212 result = 0.10; // assume 10% flavourcontribution as a minimum
198 } else { 213 } else {
199 result = 15.25 / (6 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 21) /6, 2)); 214 result = 15.25 / (6 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 21) /6, 2));
210 225
211 if (bt > 20) { 226 if (bt > 20) {
212 result = 0; 227 result = 0;
213 } else if (bt > 7.5) { 228 } else if (bt > 7.5) {
214 result = 10.03 / (4 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 7.5) /4, 2)); 229 result = 10.03 / (4 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 7.5) /4, 2));
215 } else if (use == "Boil") { 230 } else if (use == 2) { // Boil
216 result = 1; 231 result = 1;
217 } else if (use == "Aroma") { 232 } else if (use == 3) { // Aroma / vlamuit
218 result = 1.2; 233 result = 1.2;
219 } else if (use == "Whirlpool") { 234 } else if (use == 4) { // Whirlpool
220 result = 1.2; 235 result = 1.2;
221 } else if ((use == "Dry Hop") || (use == "Dry hop")) { 236 } else if (use == 5) { // Dry hop
222 result = 1.33; 237 result = 1.33;
223 } 238 }
224 result = (result * amount * 1000) / vol; 239 result = (result * amount * 1000) / vol;
225 // console.log("hopAromaContribution("+bt+","+vol+","+use+","+amount+"): "+result); 240 // console.log("hopAromaContribution("+bt+","+vol+","+use+","+amount+"): "+result);
226 return result; 241 return result;
250 265
251 function calcSVG() { 266 function calcSVG() {
252 var rows = $('#yeastGrid').jqxGrid('getrows'); 267 var rows = $('#yeastGrid').jqxGrid('getrows');
253 for (var i = 0; i < rows.length; i++) { 268 for (var i = 0; i < rows.length; i++) {
254 var row = rows[i]; 269 var row = rows[i];
255 if (row.y_use == "Primary") 270 if (row.y_use == 0) // Primary
256 svg = parseFloat(row.y_attenuation); 271 svg = parseFloat(row.y_attenuation);
257 } 272 }
258 } 273 }
259 274
260 /* function GetBUGUMin() { 275 /* function GetBUGUMin() {
410 var Result = ZRA(pHZ) * parseFloat($("#wg_amount").jqxNumberInput('decimal')); 425 var Result = ZRA(pHZ) * parseFloat($("#wg_amount").jqxNumberInput('decimal'));
411 // proton deficit for the grist 426 // proton deficit for the grist
412 var rows = $('#fermentableGrid').jqxGrid('getrows'); 427 var rows = $('#fermentableGrid').jqxGrid('getrows');
413 for (var i = 0; i < rows.length; i++) { 428 for (var i = 0; i < rows.length; i++) {
414 var row = rows[i]; 429 var row = rows[i];
415 if (row.f_added == 'Mash' && row.f_graintype != 'No malt') { 430 if (row.f_added == 0 && row.f_graintype != 6) { // Added == Mash && graintype != No Malt
416 // Check if acid is required 431 // Check if acid is required
417 var C1 = 0; 432 var C1 = 0;
418 if ((row.f_di_ph != 5.7) && ((row.f_acid_to_ph_57 < - 0.1) || (row.f_acid_to_ph_57 > 0.1))) { 433 if ((row.f_di_ph != 5.7) && ((row.f_acid_to_ph_57 < - 0.1) || (row.f_acid_to_ph_57 > 0.1))) {
419 C1 = row.f_acid_to_ph_57 / (row.f_di_ph - 5.7); 434 C1 = row.f_acid_to_ph_57 / (row.f_di_ph - 5.7);
420 } else { 435 } else {
421 // If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid. 436 // If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid.
422 var ebc = row.f_color; 437 var ebc = row.f_color;
423 switch (row.f_graintype) { 438 switch (row.f_graintype) {
424 case 'Base': 439 case 0: // Base, Special, Kilned
425 case 'Special': 440 case 3:
426 case 'Kilned': C1 = 0.014 * ebc - 34.192; 441 case 5: C1 = 0.014 * ebc - 34.192;
427 break; 442 break;
428 case 'Crystal': C1 = -0.0597 * ebc - 32.457; 443 case 2: C1 = -0.0597 * ebc - 32.457; // Crystal
429 break; 444 break;
430 case 'Roast': C1 = 0.0107 * ebc - 54.768; 445 case 1: C1 = 0.0107 * ebc - 54.768; // Roast
431 break; 446 break;
432 case 'Sour': C1 = -149; 447 case 4: C1 = -149; // Sour malt
433 break; 448 break;
434 } 449 }
435 } 450 }
436 x = C1 * (pHZ - row.f_di_ph); // AcidRequired(ZpH) 451 x = C1 * (pHZ - row.f_di_ph); // AcidRequired(ZpH)
437 // console.log(row.f_name+" C1: "+C1+" ZpH: "+pHZ+" di_ph: "+row.f_di_ph+" acid rquired: "+x); 452 // console.log(row.f_name+" C1: "+C1+" ZpH: "+pHZ+" di_ph: "+row.f_di_ph+" acid rquired: "+x);
438 Result += x * row.f_amount; 453 Result += x * row.f_amount;
460 return pH; 475 return pH;
461 } 476 }
462 477
463 function GetAcidSpecs(AT) { 478 function GetAcidSpecs(AT) {
464 switch(AT) { 479 switch(AT) {
465 case 'Melkzuur': return { 480 case 0: return { // Melkzuur
466 pK1: 3.08, 481 pK1: 3.08,
467 pK2: 20, 482 pK2: 20,
468 pK3: 20, 483 pK3: 20,
469 MolWt: 90.08, 484 MolWt: 90.08,
470 AcidSG: 1214, 485 AcidSG: 1214,
471 AcidPrc: 0.88 486 AcidPrc: 0.88
472 }; 487 };
473 case 'Zoutzuur': return { 488 case 1: return { // Zoutzuur
474 pK1: -10, 489 pK1: -10,
475 pK2: 20, 490 pK2: 20,
476 pK3: 20, 491 pK3: 20,
477 MolWt: 36.46, 492 MolWt: 36.46,
478 AcidSG: 1142, 493 AcidSG: 1142,
479 AcidPrc: 0.28 494 AcidPrc: 0.28
480 }; 495 };
481 case 'Fosforzuur': return { 496 case 2: return { // Fosforzuur
482 pK1: 2.12, 497 pK1: 2.12,
483 pK2: 7.20, 498 pK2: 7.20,
484 pK3: 12.44, 499 pK3: 12.44,
485 MolWt: 98.00, 500 MolWt: 98.00,
486 AcidSG: 1170, 501 AcidSG: 1170,
487 AcidPrc: 0.25 502 AcidPrc: 0.25
488 }; 503 };
489 case 'Zwavelzuur': return { 504 case 3: return { // Zwavelzuur
490 pK1: -10, 505 pK1: -10,
491 pK2: 1.92, 506 pK2: 1.92,
492 pK3: 20, 507 pK3: 20,
493 MolWt: 98.07, 508 MolWt: 98.07,
494 AcidSG: 1700, 509 AcidSG: 1700,
495 AcidPrc: 0.93 510 AcidPrc: 0.93
496 }; 511 };
497 } 512 }
513 console.log("Bummer, AT is " + AT);
498 } 514 }
499 515
500 // Procedure TFrmWaterAdjustment.CalcWater2; 516 // Procedure TFrmWaterAdjustment.CalcWater2;
501 function calcWater() { 517 function calcWater() {
502 518
593 if ($("#wa_base_name").val() == "") { 609 if ($("#wa_base_name").val() == "") {
594 $("#wa_base_name").val('NaHCO3'); 610 $("#wa_base_name").val('NaHCO3');
595 last_base = 'NaHCO3'; 611 last_base = 'NaHCO3';
596 } 612 }
597 613
598 var AT = $("#wa_acid_name").val(); 614 var AT = dataRecord.wa_acid_name; // parseFloat($("#wa_acid_name").jqxNumberInput('decimal'));
599 var BT = $("#wa_base_name").val(); 615 var BT = parseFloat($("#wa_base_name").jqxNumberInput('decimal'));
600 616
601 var result = GetAcidSpecs(AT); 617 var result = GetAcidSpecs(AT);
602 var pK1 = result.pK1; 618 var pK1 = result.pK1;
603 var pK2 = result.pK2; 619 var pK2 = result.pK2;
604 var pK3 = result.pK3; 620 var pK3 = result.pK3;
635 var r2d = Math.pow(10, (TpH - 10.38)); 651 var r2d = Math.pow(10, (TpH - 10.38));
636 var f1d = 1 / (1 + r1d + r1d * r2d); 652 var f1d = 1 / (1 + r1d + r1d * r2d);
637 var f2d = f1d * r1d; 653 var f2d = f1d * r1d;
638 var f3d = f2d * r2d; 654 var f3d = f2d * r2d;
639 switch (BT) { 655 switch (BT) {
640 case 'NaHCO3': RA = -protonDeficit / (f1d - f3d); //mmol totaal 656 case 0: RA = -protonDeficit / (f1d - f3d); //Sodiumbicarbonate, mmol totaal
641 RA = RA * MMNaHCO3/1000; //gram 657 RA = RA * MMNaHCO3/1000; //gram
642 $("#wa_base").val(Math.round(RA * 100) / 100); 658 $("#wa_base").val(Math.round(RA * 100) / 100);
643 setWaterAgent(BT, Math.round(RA * 100) / 100); 659 setWaterAgent(BT, Math.round(RA * 100) / 100);
644 if (liters > 0) { 660 if (liters > 0) {
645 // Na 661 // Na
646 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl + 662 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl +
647 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMNa / MMNaHCO3; 663 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMNa / MMNaHCO3;
648 RA = 1000 * RA / liters; 664 RA = 1000 * RA / liters;
649 sodium = wg_sodium + RA; 665 sodium = wg_sodium + RA;
650 // HCO3 666 // HCO3
651 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3; 667 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3;
652 RA = 1000 * RA / liters; 668 RA = 1000 * RA / liters;
653 bicarbonate = wg_bicarbonate + RA; 669 bicarbonate = wg_bicarbonate + RA;
654 total_alkalinity = bicarbonate * 50 / 61; 670 total_alkalinity = bicarbonate * 50 / 61;
655 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); 671 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
656 } 672 }
657 break; 673 break;
658 case 'Na2CO3': RA = -protonDeficit / (2 * f1d + f2d); //mmol totaal 674 case 1: RA = -protonDeficit / (2 * f1d + f2d); // Sodiumcarbonate, mmol totaal
659 RA = RA * MMNa2CO3/1000; //gram 675 RA = RA * MMNa2CO3/1000; //gram
660 $("#wa_base").val(Math.round(RA * 100) / 100); 676 $("#wa_base").val(Math.round(RA * 100) / 100);
661 setWaterAgent(BT, Math.round(RA * 100) / 100); 677 setWaterAgent(BT, Math.round(RA * 100) / 100);
662 if (liters > 0) { 678 if (liters > 0) {
663 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl + 679 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl +
664 parseFloat($("#wa_base").jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3; 680 parseFloat($("#wa_base").jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3;
665 RA = 1000 * RA / liters; 681 RA = 1000 * RA / liters;
666 sodium = wg_sodium + RA; 682 sodium = wg_sodium + RA;
667 // HCO3 683 // HCO3
668 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3; 684 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3;
669 RA = 1000 * RA / liters; 685 RA = 1000 * RA / liters;
670 bicarbonate = wg_bicarbonate + RA; 686 bicarbonate = wg_bicarbonate + RA;
671 total_alkalinity = bicarbonate * 50 / 61; 687 total_alkalinity = bicarbonate * 50 / 61;
672 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); 688 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
673 } 689 }
674 break; 690 break;
675 case 'CaCO3': RA = -protonDeficit * (f1d - f3d); //mmol totaal 691 case 2: RA = -protonDeficit * (f1d - f3d); // Calciumcarbonate, mmol totaal
676 RA = RA * MMCaCO3/1000; //gram 692 RA = RA * MMCaCO3/1000; //gram
677 //but only 1/3 is effective, so add 3 times as much 693 //but only 1/3 is effective, so add 3 times as much
678 RA = 3 * RA; 694 RA = 3 * RA;
679 $("#wa_base").val(Math.round(RA * 100) / 100); 695 $("#wa_base").val(Math.round(RA * 100) / 100);
680 setWaterAgent(BT, Math.round(RA * 100) / 100); 696 setWaterAgent(BT, Math.round(RA * 100) / 100);
681 if (liters > 0) { 697 if (liters > 0) {
682 //Bicarbonate 698 //Bicarbonate
683 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3; 699 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3;
684 RA = 1000 * RA / liters; 700 RA = 1000 * RA / liters;
685 bicarbonate = wg_bicarbonate + RA; 701 bicarbonate = wg_bicarbonate + RA;
686 total_alkalinity = bicarbonate * 50 / 61; 702 total_alkalinity = bicarbonate * 50 / 61;
687 //Ca precipitates out as Ca10(PO4)6(OH)2 703 //Ca precipitates out as Ca10(PO4)6(OH)2
688 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 + 704 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 +
689 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 + 705 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 +
690 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaCO3; 706 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaCO3;
691 RA = 1000 * RA / liters; 707 RA = 1000 * RA / liters;
692 calcium = wg_calcium + RA; 708 calcium = wg_calcium + RA;
693 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); 709 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
694 } 710 }
695 break; 711 break;
696 case 'Ca(OH)2': RA = -protonDeficit / 19.3; // g 712 case 3: RA = -protonDeficit / 19.3; // Calciumhydroxide
697 $("#wa_base").val(Math.round(RA * 100) / 100); 713 $("#wa_base").val(Math.round(RA * 100) / 100);
698 setWaterAgent(BT, Math.round(RA * 100) / 100); 714 setWaterAgent(BT, Math.round(RA * 100) / 100);
699 if (liters > 0) { 715 if (liters > 0) {
700 // Bicarbonate 716 // Bicarbonate
701 RA = -protonDeficit / liters; 717 RA = -protonDeficit / liters;
702 total_alkalinity = wg_total_alkalinity + RA; 718 total_alkalinity = wg_total_alkalinity + RA;
703 bicarbonate = total_alkalinity * 61 / 50; 719 bicarbonate = total_alkalinity * 61 / 50;
704 // Calcium 720 // Calcium
705 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 + 721 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 +
706 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 + 722 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 +
707 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaOH2; 723 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaOH2;
708 RA = 1000 * RA / liters; 724 RA = 1000 * RA / liters;
709 calcium = wg_calcium + RA; 725 calcium = wg_calcium + RA;
710 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); 726 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
711 } 727 }
712 break; 728 break;
713 } 729 }
714 } 730 }
715 ph = TpH; 731 ph = TpH;
716 $('#wb_ph').val(Math.round(ph * 10) / 10); 732 $('#wb_ph').val(Math.round(ph * 10) / 10);
717 } else { // Manual 733 } else { // Manual
718 console.log("calc_acid no"); 734 console.log("calc_acid no");
719 // First add base salts 735 // First add base salts
720 if (parseFloat($("#wa_base").jqxNumberInput('decimal')) > 0) { 736 if (parseFloat($("#wa_base").jqxNumberInput('decimal')) > 0) {
721 if (liters > 0) { 737 if (liters > 0) {
722 switch (BT) { 738 switch (BT) {
723 case 'NaHCO3': // Na 739 case 0: // Sodiumbicarbonate, Na
724 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl + 740 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl +
725 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMNa / MMNaHCO3; 741 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMNa / MMNaHCO3;
726 RA = 1000 * RA / liters; 742 RA = 1000 * RA / liters;
727 sodium = wg_sodium + RA; 743 sodium = wg_sodium + RA;
728 // HCO3 744 // HCO3
729 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3; 745 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3;
730 RA = 1000 * RA / liters; 746 RA = 1000 * RA / liters;
731 bicarbonate = wg_bicarbonate + RA; 747 bicarbonate = wg_bicarbonate + RA;
732 total_alkalinity = bicarbonate * 50 / 61; 748 total_alkalinity = bicarbonate * 50 / 61;
733 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); 749 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
734 break; 750 break;
735 case 'Na2CO3': RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl + 751 case 1: // Sodiumcarbonate
736 parseFloat($("#wa_base").jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3; 752 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl +
737 RA = 1000 * RA / liters; 753 parseFloat($("#wa_base").jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3;
738 sodium = wg_sodium + RA; 754 RA = 1000 * RA / liters;
739 // HCO3 755 sodium = wg_sodium + RA;
740 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3; 756 // HCO3
741 RA = 1000 * RA / liters; 757 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3;
742 bicarbonate = wg_bicarbonate + RA; 758 RA = 1000 * RA / liters;
743 total_alkalinity = bicarbonate * 50 / 61; 759 bicarbonate = wg_bicarbonate + RA;
744 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); 760 total_alkalinity = bicarbonate * 50 / 61;
745 break; 761 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
746 case 'CaCO3': // Bicarbonate 762 break;
747 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3; 763 case 2: // Calciumcarbonate: Bicarbonate
748 RA = 1000 * RA / liters; 764 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3;
749 bicarbonate = wg_bicarbonate + RA; 765 RA = 1000 * RA / liters;
750 total_alkalinity = bicarbonate * 50 / 61; 766 bicarbonate = wg_bicarbonate + RA;
751 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); 767 total_alkalinity = bicarbonate * 50 / 61;
752 // Ca 768 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
753 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 + 769 // Ca
754 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 + 770 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 +
755 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaCO3; 771 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 +
756 RA = 1000 * RA / liters; 772 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaCO3;
757 calcium = wg_calcium + RA; 773 RA = 1000 * RA / liters;
758 break; 774 calcium = wg_calcium + RA;
775 break;
759 } 776 }
760 } 777 }
761 } 778 }
762 779
763 TpH = parseFloat(dataRecord.mash_ph); 780 TpH = parseFloat(dataRecord.mash_ph);
800 ph = pHa; 817 ph = pHa;
801 $('#wb_ph').val(Math.round(ph * 10) / 10); 818 $('#wb_ph').val(Math.round(ph * 10) / 10);
802 } 819 }
803 } 820 }
804 821
805 if ((AT == 'Zwavelzuur') && (liters > 0)) { 822 if ((AT == 3) && (liters > 0)) { // Sulfuctic / Zwavelzuur
806 RA = parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 + 823 RA = parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 +
807 parseFloat($("#wa_mgso4").jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 + 824 parseFloat($("#wa_mgso4").jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 +
808 Acidmg / 1000 * MMSO4 / (MMSO4 + 2); 825 Acidmg / 1000 * MMSO4 / (MMSO4 + 2);
809 RA = 1000 * RA / liters; 826 RA = 1000 * RA / liters;
810 sulfate = wg_sulfate + RA; // Not add to sulfate?? 827 sulfate = wg_sulfate + RA; // Not add to sulfate??
811 } else if ((AT == 'Zoutzuur') && (liters > 0)) { 828 } else if ((AT == 1) && (liters > 0)) { // Hydrochloric, Zoutzuur
812 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCl / MMCaCl2 + 829 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCl / MMCaCl2 +
813 parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMCl / MMNaCl + 830 parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMCl / MMNaCl +
814 Acidmg / 1000 * MMCl / (MMCL + 1); 831 Acidmg / 1000 * MMCl / (MMCL + 1);
815 RA = 1000 * RA / liters; 832 RA = 1000 * RA / liters;
816 chloride = wg_chloride + RA; 833 chloride = wg_chloride + RA;
930 var f3g = r1g * r2g / dg; 947 var f3g = r1g * r2g / dg;
931 948
932 //Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L) 949 //Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L)
933 var Acid = alkalinity * ((f1g-f1)+(f3-f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH); //mEq/l 950 var Acid = alkalinity * ((f1g-f1)+(f3-f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH); //mEq/l
934 951
935 if ($("#sparge_acid_type").val() == "") { 952 if ($("#sparge_acid_type").val() == NaN) {
936 $("#sparge_acid_type").val('Melkzuur'); 953 $("#sparge_acid_type").val(0);
937 dataRecord.sparge_acid_type = 'Melkzuur'; 954 dataRecord.sparge_acid_type = 0;
938 } 955 }
939 var AT = dataRecord.sparge_acid_type; 956 var AT = dataRecord.sparge_acid_type;
940 var result = GetAcidSpecs(AT); 957 var result = GetAcidSpecs(AT);
941 var pK1 = result.pK1; 958 var pK1 = result.pK1;
942 var pK2 = result.pK2; 959 var pK2 = result.pK2;
972 var sug = sg_to_plato(OG) * parseFloat($("#batch_size").jqxNumberInput('decimal')) * OG / 100; //total amount of sugars in kg 989 var sug = sg_to_plato(OG) * parseFloat($("#batch_size").jqxNumberInput('decimal')) * OG / 100; //total amount of sugars in kg
973 var tot = 0; 990 var tot = 0;
974 for (var i = 0; i < rows.length; i++) { 991 for (var i = 0; i < rows.length; i++) {
975 var row = rows[i]; 992 var row = rows[i];
976 var d = row.f_percentage / 100 * (row.f_yield / 100) * (1 - row.f_moisture / 100); 993 var d = row.f_percentage / 100 * (row.f_yield / 100) * (1 - row.f_moisture / 100);
977 if (row.f_added == "Mash") 994 if (row.f_added == 0) // Mash
978 d = efficiency / 100 * d; 995 d = efficiency / 100 * d;
979 tot += d; 996 tot += d;
980 } 997 }
981 998
982 var totmass = 0; 999 var totmass = 0;
1067 setWaterAgent($("#wa_acid_name").val(), parseFloat(event.args.value)); 1084 setWaterAgent($("#wa_acid_name").val(), parseFloat(event.args.value));
1068 calcWater(); 1085 calcWater();
1069 }); 1086 });
1070 $('#wa_acid_perc').on('change', function (event) { calcWater(); }); 1087 $('#wa_acid_perc').on('change', function (event) { calcWater(); });
1071 1088
1072 $('#color_method').on('change', function (event) { calcFermentables(); }); 1089 $('#color_method').on('change', function (event) {
1090 dataRecord.color_method = event.args.index;
1091 calcFermentables();
1092 });
1073 $('#ibu_method').on('change', function (event) { 1093 $('#ibu_method').on('change', function (event) {
1094 dataRecord.ibu_method = event.args.index;
1074 calcFermentables(); 1095 calcFermentables();
1075 calcIBUs(); 1096 calcIBUs();
1076 }); 1097 });
1077 $('#batch_size').on('change', function (event) { 1098 $('#batch_size').on('change', function (event) {
1078 console.log("batch_size change:"+event.args.value+" old:"+dataRecord.batch_size); 1099 console.log("batch_size change:"+event.args.value+" old:"+dataRecord.batch_size);
1155 $("#styleSelect").jqxDropDownList({ 1176 $("#styleSelect").jqxDropDownList({
1156 placeHolder: "Kies bierstijl:", 1177 placeHolder: "Kies bierstijl:",
1157 theme: theme, 1178 theme: theme,
1158 source: styleslist, 1179 source: styleslist,
1159 displayMember: "name", 1180 displayMember: "name",
1160 width: 150, 1181 width: 180,
1161 height: 27, 1182 height: 23,
1162 dropDownVerticalAlignment: 'top', 1183 dropDownVerticalAlignment: 'top',
1163 dropDownWidth: 500, 1184 dropDownWidth: 500,
1164 dropDownHeight: 380, 1185 dropDownHeight: 380,
1165 renderer: function (index, label, value) { 1186 renderer: function (index, label, value) {
1166 var datarecord = styleslist.records[index]; 1187 var datarecord = styleslist.records[index];
1174 $("#st_name").val(datarecord.name); 1195 $("#st_name").val(datarecord.name);
1175 $("#st_category").val(datarecord.category); 1196 $("#st_category").val(datarecord.category);
1176 $("#st_category_number").val(datarecord.category_number); 1197 $("#st_category_number").val(datarecord.category_number);
1177 $("#st_letter").val(datarecord.style_letter); 1198 $("#st_letter").val(datarecord.style_letter);
1178 $("#st_guide").val(datarecord.style_guide); 1199 $("#st_guide").val(datarecord.style_guide);
1179 $("#st_type").val(datarecord.type); 1200 $("#st_type").val(StyleTypeData[datarecord.type].nl);
1180 $("#st_og_min").val(datarecord.og_min); 1201 $("#st_og_min").val(datarecord.og_min);
1181 $("#st_og_max").val(datarecord.og_max); 1202 $("#st_og_max").val(datarecord.og_max);
1182 $("#st_fg_min").val(datarecord.fg_min); 1203 $("#st_fg_min").val(datarecord.fg_min);
1183 $("#st_fg_max").val(datarecord.fg_max); 1204 $("#st_fg_max").val(datarecord.fg_max);
1184 $("#st_ibu_min").val(datarecord.ibu_min); 1205 $("#st_ibu_min").val(datarecord.ibu_min);
1192 } 1213 }
1193 }); 1214 });
1194 1215
1195 var dataRecord = {}; 1216 var dataRecord = {};
1196 var url = "includes/db_recipes.php"; 1217 var url = "includes/db_recipes.php";
1197 // tooltips
1198 $("#name").jqxTooltip({ content: 'De naam voor dit recept.' });
1199 $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' });
1200 $("#type").jqxTooltip({ content: 'Het brouw type van dit recept.' });
1201 $("#batch_size").jqxTooltip({ content: 'Het volume van het gekoelde wort na het koken.' });
1202 $("#boil_time").jqxTooltip({ content: 'De kooktijd in minuten.' });
1203 $("#boil_size").jqxTooltip({ content: 'Het volume van het wort voor het koken.' });
1204 $("#efficiency").jqxTooltip({ content: 'Het rendement van maischen en koken.' });
1205 $("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
1206 $("#est_og2").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
1207 $("#est_fg").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' });
1208 $("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
1209 $("#est_color2").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
1210 $("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
1211 $("#est_ibu2").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
1212 $("#est_abv").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
1213 $("#est_carb").jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' });
1214
1215 $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'});
1216 $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'});
1217 $("#st_guide").jqxTooltip({ content: 'De bierstijl gids voor dit recept.'});
1218 $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'});
1219 $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'});
1220 $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'});
1221 $("#st_og_min").jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'});
1222 $("#st_og_max").jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'});
1223 $("#st_fg_min").jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'});
1224 $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'});
1225 $("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'});
1226 $("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'});
1227 $("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'});
1228 $("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'});
1229 $("#st_abv_min").jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'});
1230 $("#st_abv_max").jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'});
1231 $("#st_carb_min").jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'});
1232 $("#st_carb_max").jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'});
1233 $("#mash_ph").jqxTooltip({ content: 'Maisch pH tussen 5.2 en 5.6. Gebruik 5.2 voor lichte en 5.5 voor donkere bieren.'});
1234 $("#wa_cacl2").jqxTooltip({ content: 'Voor het maken van een ander waterprofiel. Voegt calcium en chloride toe. Voor het verbeteren van zoetere bieren.'});
1235 $("#wa_caso4").jqxTooltip({ content: 'Gips. Voor het maken van een ander waterprofiel. Voegt calcium en sulfaat toe. Voor het verbeteren van bittere bieren.'});
1236 $("#wa_mgso4").jqxTooltip({ content: 'Epsom zout. Voor het maken van een ander waterprofiel. Voegt magnesium en sulfaat toe. Gebruik spaarzaam!'});
1237 $("#wa_nacl").jqxTooltip({ content: 'Keukenzout. Voor het maken van een ander waterprofiel. Voegt natrium en chloride toe. Voor het accentueren van zoetheid. Bij hoge dosering wordt het bier ziltig.'});
1238 $("#w2_amount").jqxTooltip({ content: 'De verdeling van het hoofd en meng water. Het totale maisch water volume blijft gelijk.'});
1239
1240 $("#wb_calcium").jqxTooltip({ content: 'De ideale hoeveelheid Calcium is tussen 40 en 150.'});
1241 $("#wb_magnesium").jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is lager dan 30.'});
1242 $("#wb_sodium").jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'});
1243 $("#wb_chloride").jqxTooltip({ content: 'De ideale hoeveelheid Chloride is lager dan 100.'});
1244 $("#wb_sulfate").jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is lager dan 350.'});
1245 1218
1246 // prepare the data 1219 // prepare the data
1247 var source = { 1220 var source = {
1248 datatype: "json", 1221 datatype: "json",
1249 cache: false, 1222 cache: false,
1252 { name: 'uuid', type: 'string' }, 1225 { name: 'uuid', type: 'string' },
1253 { name: 'locked', type: 'bool' }, 1226 { name: 'locked', type: 'bool' },
1254 { name: 'st_name', type: 'string' }, 1227 { name: 'st_name', type: 'string' },
1255 { name: 'st_letter', type: 'string' }, 1228 { name: 'st_letter', type: 'string' },
1256 { name: 'st_guide', type: 'string' }, 1229 { name: 'st_guide', type: 'string' },
1257 { name: 'st_type', type: 'string' }, 1230 { name: 'st_type', type: 'int' },
1258 { name: 'st_category', type: 'string' }, 1231 { name: 'st_category', type: 'string' },
1259 { name: 'st_category_number', type: 'float' }, 1232 { name: 'st_category_number', type: 'float' },
1260 { name: 'st_og_min', type: 'float' }, 1233 { name: 'st_og_min', type: 'float' },
1261 { name: 'st_og_max', type: 'float' }, 1234 { name: 'st_og_max', type: 'float' },
1262 { name: 'st_fg_min', type: 'float' }, 1235 { name: 'st_fg_min', type: 'float' },
1269 { name: 'st_carb_max', type: 'float' }, 1242 { name: 'st_carb_max', type: 'float' },
1270 { name: 'st_abv_min', type: 'float' }, 1243 { name: 'st_abv_min', type: 'float' },
1271 { name: 'st_abv_max', type: 'float' }, 1244 { name: 'st_abv_max', type: 'float' },
1272 { name: 'name', type: 'string' }, 1245 { name: 'name', type: 'string' },
1273 { name: 'notes', type: 'string' }, 1246 { name: 'notes', type: 'string' },
1274 { name: 'type', type: 'string' }, 1247 { name: 'type', type: 'int' },
1275 { name: 'batch_size', type: 'float' }, 1248 { name: 'batch_size', type: 'float' },
1276 { name: 'boil_size', type: 'float' }, 1249 { name: 'boil_size', type: 'float' },
1277 { name: 'boil_time', type: 'float' }, 1250 { name: 'boil_time', type: 'float' },
1278 { name: 'efficiency', type: 'float' }, 1251 { name: 'efficiency', type: 'float' },
1279 { name: 'est_og', type: 'float' }, 1252 { name: 'est_og', type: 'float' },
1280 { name: 'est_fg', type: 'float' }, 1253 { name: 'est_fg', type: 'float' },
1281 { name: 'est_abv', type: 'float' }, 1254 { name: 'est_abv', type: 'float' },
1282 { name: 'est_color', type: 'float' }, 1255 { name: 'est_color', type: 'float' },
1283 { name: 'color_method', type: 'string' }, 1256 { name: 'color_method', type: 'int' },
1284 { name: 'est_ibu', type: 'float' }, 1257 { name: 'est_ibu', type: 'float' },
1285 { name: 'ibu_method', type: 'string' }, 1258 { name: 'ibu_method', type: 'int' },
1286 { name: 'est_carb', type: 'float' }, 1259 { name: 'est_carb', type: 'float' },
1287 { name: 'sparge_temp', type: 'float' }, 1260 { name: 'sparge_temp', type: 'float' },
1288 { name: 'sparge_ph', type: 'float' }, 1261 { name: 'sparge_ph', type: 'float' },
1289 { name: 'sparge_volume', type: 'float' }, 1262 { name: 'sparge_volume', type: 'float' },
1290 { name: 'sparge_source', type: 'string' }, 1263 { name: 'sparge_source', type: 'string' },
1291 { name: 'sparge_acid_type', type: 'string' }, 1264 { name: 'sparge_acid_type', type: 'int' },
1292 { name: 'sparge_acid_perc', type: 'float' }, 1265 { name: 'sparge_acid_perc', type: 'float' },
1293 { name: 'sparge_acid_amount', type: 'float' }, 1266 { name: 'sparge_acid_amount', type: 'float' },
1294 { name: 'mash_ph', type: 'float' }, 1267 { name: 'mash_ph', type: 'float' },
1295 { name: 'mash_name', type: 'string' }, 1268 { name: 'mash_name', type: 'string' },
1296 { name: 'calc_acid', type: 'bool' }, 1269 { name: 'calc_acid', type: 'bool' },
1312 { name: 'w2_sodium', type: 'float' }, 1285 { name: 'w2_sodium', type: 'float' },
1313 { name: 'w2_magnesium', type: 'float' }, 1286 { name: 'w2_magnesium', type: 'float' },
1314 { name: 'w2_total_alkalinity', type: 'float' }, 1287 { name: 'w2_total_alkalinity', type: 'float' },
1315 { name: 'w2_ph', type: 'float' }, 1288 { name: 'w2_ph', type: 'float' },
1316 { name: 'w2_cost', type: 'float' }, 1289 { name: 'w2_cost', type: 'float' },
1290 { name: 'wa_acid_name', type: 'int' },
1291 { name: 'wa_acid_perc', type: 'int' },
1292 { name: 'wa_base_name', type: 'int' },
1317 { name: 'fermentables', type: 'array' }, 1293 { name: 'fermentables', type: 'array' },
1318 { name: 'hops', type: 'string' }, 1294 { name: 'hops', type: 'array' },
1319 { name: 'miscs', type: 'string' }, 1295 { name: 'miscs', type: 'array' },
1320 { name: 'yeasts', type: 'string' }, 1296 { name: 'yeasts', type: 'array' },
1321 { name: 'mashs', type: 'string' } 1297 { name: 'mashs', type: 'array' }
1322 ], 1298 ],
1323 id: 'record', 1299 id: 'record',
1324 url: url + '?record=' + my_record 1300 url: url + '?record=' + my_record
1325 }; 1301 };
1326 // Load data and select one record. 1302 // Load data and select one record.
1335 $("#st_name").val(dataRecord.st_name); 1311 $("#st_name").val(dataRecord.st_name);
1336 $("#st_letter").val(dataRecord.st_letter); 1312 $("#st_letter").val(dataRecord.st_letter);
1337 $("#st_guide").val(dataRecord.st_guide); 1313 $("#st_guide").val(dataRecord.st_guide);
1338 $("#st_category").val(dataRecord.st_category); 1314 $("#st_category").val(dataRecord.st_category);
1339 $("#st_category_number").val(dataRecord.st_category_number); 1315 $("#st_category_number").val(dataRecord.st_category_number);
1340 $("#st_type").val(dataRecord.st_type); 1316 $("#st_type").val(StyleTypeData[dataRecord.st_type].nl);
1341 $("#type").val(dataRecord.type); 1317 $("#type").val(dataRecord.type);
1342 $("#batch_size").val(dataRecord.batch_size); 1318 $("#batch_size").val(dataRecord.batch_size);
1343 $("#boil_size").val(dataRecord.boil_size); 1319 $("#boil_size").val(dataRecord.boil_size);
1344 $("#boil_time").val(dataRecord.boil_time); 1320 $("#boil_time").val(dataRecord.boil_time);
1345 $("#efficiency").val(dataRecord.efficiency); 1321 $("#efficiency").val(dataRecord.efficiency);
1394 $("#w2_sodium").val(dataRecord.w2_sodium); 1370 $("#w2_sodium").val(dataRecord.w2_sodium);
1395 $("#w2_magnesium").val(dataRecord.w2_magnesium); 1371 $("#w2_magnesium").val(dataRecord.w2_magnesium);
1396 $("#w2_total_alkalinity").val(dataRecord.w2_total_alkalinity); 1372 $("#w2_total_alkalinity").val(dataRecord.w2_total_alkalinity);
1397 $("#w2_ph").val(dataRecord.w2_ph); 1373 $("#w2_ph").val(dataRecord.w2_ph);
1398 $("#w2_cost").val(dataRecord.w2_cost); 1374 $("#w2_cost").val(dataRecord.w2_cost);
1375 $("#wa_acid_name").val(dataRecord.wa_acid_name);
1376 $("#wa_acid_perc").val(dataRecord.wa_acid_perc);
1377 $("#wa_base_name").val(dataRecord.wa_base_name);
1399 editFermentable(dataRecord); 1378 editFermentable(dataRecord);
1400 editHop(dataRecord); 1379 editHop(dataRecord);
1401 editMisc(dataRecord); 1380 editMisc(dataRecord);
1402 editYeast(dataRecord); 1381 editYeast(dataRecord);
1403 editMash(dataRecord); 1382 editMash(dataRecord);
1422 { name: 'f_name', type: 'string' }, 1401 { name: 'f_name', type: 'string' },
1423 { name: 'f_origin', type: 'string' }, 1402 { name: 'f_origin', type: 'string' },
1424 { name: 'f_supplier', type: 'string' }, 1403 { name: 'f_supplier', type: 'string' },
1425 { name: 'f_amount', type: 'float' }, 1404 { name: 'f_amount', type: 'float' },
1426 { name: 'f_cost', type: 'float' }, 1405 { name: 'f_cost', type: 'float' },
1427 { name: 'f_type', type: 'string' }, 1406 { name: 'f_type', type: 'int' },
1428 { name: 'f_yield', type: 'float' }, 1407 { name: 'f_yield', type: 'float' },
1429 { name: 'f_color', type: 'float' }, 1408 { name: 'f_color', type: 'float' },
1430 { name: 'f_coarse_fine_diff', type: 'float' }, 1409 { name: 'f_coarse_fine_diff', type: 'float' },
1431 { name: 'f_moisture', type: 'float' }, 1410 { name: 'f_moisture', type: 'float' },
1432 { name: 'f_diastatic_power', type: 'float' }, 1411 { name: 'f_diastatic_power', type: 'float' },
1433 { name: 'f_protein', type: 'float' }, 1412 { name: 'f_protein', type: 'float' },
1434 { name: 'f_max_in_batch', type: 'float' }, 1413 { name: 'f_max_in_batch', type: 'float' },
1435 { name: 'f_graintype', type: 'string' }, 1414 { name: 'f_graintype', type: 'int' },
1436 { name: 'f_added', type: 'string' }, 1415 { name: 'f_added', type: 'int' },
1437 { name: 'f_dissolved_protein', type: 'float' }, 1416 { name: 'f_dissolved_protein', type: 'float' },
1438 { name: 'f_recommend_mash', type: 'bool' }, 1417 { name: 'f_recommend_mash', type: 'int' },
1439 { name: 'f_add_after_boil', type: 'bool' }, 1418 { name: 'f_add_after_boil', type: 'int' },
1440 { name: 'f_adjust_to_total_100', type: 'bool' }, 1419 { name: 'f_adjust_to_total_100', type: 'int' },
1441 { name: 'f_percentage', type: 'float' }, 1420 { name: 'f_percentage', type: 'float' },
1442 { name: 'f_di_ph', type: 'float' }, 1421 { name: 'f_di_ph', type: 'float' },
1443 { name: 'f_acid_to_ph_57', type: 'float' } 1422 { name: 'f_acid_to_ph_57', type: 'float' },
1423 { name: 'f_stock', type: 'float' },
1444 ], 1424 ],
1445 addrow: function (rowid, rowdata, position, commit) { 1425 addrow: function (rowid, rowdata, position, commit) {
1446 commit(true); 1426 commit(true);
1447 }, 1427 },
1448 deleterow: function (rowid, commit) { 1428 deleterow: function (rowid, commit) {
1449 commit(true); 1429 commit(true);
1450 } 1430 }
1451 }; 1431 };
1452 var fermentableAdapter = new $.jqx.dataAdapter(fermentableSource); 1432 var fermentableAdapter = new $.jqx.dataAdapter(fermentableSource);
1453 $("#fermentableGrid").jqxGrid({ 1433 $("#fermentableGrid").jqxGrid({
1454 width: 1150, 1434 width: 1240,
1455 height: 400, 1435 height: 400,
1456 source: fermentableAdapter, 1436 source: fermentableAdapter,
1457 theme: theme, 1437 theme: theme,
1458 selectionmode: 'singlerow', 1438 selectionmode: 'singlerow',
1459 editmode: 'selectedcell',
1460 editable: true,
1461 localization: getLocalization(), 1439 localization: getLocalization(),
1462 showtoolbar: true, 1440 showtoolbar: true,
1463 rendertoolbar: function (toolbar) { 1441 rendertoolbar: function (toolbar) {
1464 var me = this; 1442 var me = this;
1465 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 1443 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
1502 row["f_diastatic_power"] = datarecord.diastatic_power; 1480 row["f_diastatic_power"] = datarecord.diastatic_power;
1503 row["f_protein"] = datarecord.protein; 1481 row["f_protein"] = datarecord.protein;
1504 row["f_max_in_batch"] = datarecord.max_in_batch; 1482 row["f_max_in_batch"] = datarecord.max_in_batch;
1505 row["f_graintype"] = datarecord.graintype; 1483 row["f_graintype"] = datarecord.graintype;
1506 if (datarecord.add_after_boil) { 1484 if (datarecord.add_after_boil) {
1507 row["f_added"] = "Primary"; 1485 row["f_added"] = 2; // Fermentation
1508 } else if ((datarecord.type == "Sugar") || (datarecord.type == "Adjunct")) { 1486 } else if ((datarecord.type == 1) || (datarecord.type == 4)) { // Sugar or Adjunct
1509 row["f_added"] = "Boil"; 1487 row["f_added"] = 1; // Boil
1510 } else { 1488 } else {
1511 row["f_added"] = "Mash"; 1489 row["f_added"] = 0; // Mash
1512 } 1490 }
1513 row["f_dissolved_protein"] = 0; 1491 row["f_dissolved_protein"] = datarecord.dissolved_protein;
1514 row["f_recommend_mash"] = datarecord.recommend_mash; 1492 row["f_recommend_mash"] = datarecord.recommend_mash;
1515 row["f_add_after_boil"] = datarecord.add_after_boil; 1493 row["f_add_after_boil"] = datarecord.add_after_boil;
1516 if (rowscount == 0) { 1494 if (rowscount == 0) {
1517 // The first fermentable 1495 // The first fermentable
1518 row["f_adjust_to_total_100"] = 1; 1496 row["f_adjust_to_total_100"] = 1;
1578 ready: function() { 1556 ready: function() {
1579 calcFermentables(); 1557 calcFermentables();
1580 $('#jqxTabs').jqxTabs('next'); 1558 $('#jqxTabs').jqxTabs('next');
1581 }, 1559 },
1582 columns: [ 1560 columns: [
1583 { text: 'Vergistbaar ingredi&euml;nt', editable: false, datafield: 'f_name', 1561 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name',
1584 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) { 1562 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) {
1585 var rowData = $("#fermentableGrid").jqxGrid('getrowdata', row); 1563 var rowData = $("#fermentableGrid").jqxGrid('getrowdata', row);
1586 return "<span style='margin: 3px; margin-top: 6px; float: "+ 1564 return "<span style='margin: 3px; margin-top: 6px; float: "+
1587 columnproperties.cellsalign+"'>" +rowData.f_supplier+" / "+rowData.f_name+" ("+rowData.f_color+" EBC)</span>"; 1565 columnproperties.cellsalign+"'>" +rowData.f_supplier+" / "+rowData.f_name+" ("+rowData.f_color+" EBC)</span>";
1588 } 1566 }
1589 }, 1567 },
1590 { text: 'Type', editable: false, align: 'center', cellsalign: 'center', width: 100, datafield: 'f_type' }, 1568 { text: 'Type', width: 100, datafield: 'f_type',
1591 { text: 'Moment', width: 110, align: 'center', cellsalign: 'center', datafield: 'f_added', columntype: 'dropdownlist', 1569 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
1592 createeditor: function (row, column, editor) { 1570 return "<div style='margin: 4px;'>" + FermentableTypeData[value].nl + "</div>";
1593 var srcAdded = [ "Mash", "Boil", "Fermentation", "Lagering", "Bottle" ]; 1571 }
1594 editor.jqxDropDownList({ autoDropDownHeight: true, source: srcAdded }); 1572 },
1573 { text: 'Moment', width: 110, datafield: 'f_added',
1574 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
1575 return "<div style='margin: 4px;'>" + AddedData[value].nl + "</div>";
1595 } 1576 }
1596 }, 1577 },
1597 { text: 'Opbrengst', editable: false, datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, 1578 { text: 'Opbrengst', editable: false, datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
1598 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3', 1579 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
1599 columntype: 'numberinput', 1580 { text: 'Voorr. Kg', datafield: 'f_stock', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
1600 validation: function (cell, value) { 1581 { text: 'Percent', datafield: 'f_percentage', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
1601 // Maximum weight is the batch_size, just a simple check. 1582 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 },
1602 var maxmout = parseFloat($("#batch_size").jqxNumberInput('decimal')); 1583 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
1603 if (value < 0 || value > maxmout) { 1584 return "Wijzig";
1604 return { result: false, message: "Gewicht moet 0-"+maxmout+" zijn" }; 1585 }, buttonclick: function (row) {
1605 } 1586 fermentableRow = row;
1606 return true; 1587 fermentableData = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow);
1607 }, 1588 $("#wf_name").val(fermentableData.f_name);
1608 initeditor: function (row, cellvalue, editor) { 1589 $("#wf_amount").val(fermentableData.f_amount);
1609 editor.jqxNumberInput({ inputMode: 'simple', min: 0, decimalDigits: 3, spinButtons: false }); 1590 $("#wf_percentage").val(fermentableData.f_percentage);
1610 }, 1591 $("#wf_adjust_to_total_100").val(fermentableData.f_adjust_to_total_100);
1611 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) { 1592 $("#wf_added").val(fermentableData.f_added);
1612 if (to_100) { 1593 // show the popup window.
1613 return oldvalue; // When using percentages, don't allow edited results. 1594 $("#popupFermentable").jqxWindow('open');
1614 } 1595 }
1615 } 1596 }
1616 },
1617 { text: 'Percentage', datafield: 'f_percentage', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'p1',
1618 columntype: 'numberinput',
1619 validation: function (cell, value) {
1620 if (value < 0 || value > 100) {
1621 return { result: false, message: "Percentage moet 0-100 zijn" };
1622 }
1623 return true;
1624 },
1625 initeditor: function (row, cellvalue, editor) {
1626 editor.jqxNumberInput({ decimalDigits: 1, min: 0, max: 100, spinButtons: false });
1627 },
1628 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) {
1629 oldvalue = Math.round(oldvalue * 10) / 10.0;
1630 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
1631 if ((oldvalue != newvalue) && (rowscount > 1)) {
1632 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', row);
1633 if (rowdata.f_adjust_to_total_100) {
1634 return oldvalue;
1635 }
1636 var diff = newvalue - oldvalue;
1637 var tw = 0; // total weight
1638 for (i = 0; i < rowscount; i++) {
1639 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
1640 tw += rowdata.f_amount;
1641 }
1642 if (to_100) {
1643 // Adjust this row and the 100% row.
1644 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', row);
1645 rowdata.f_amount += tw * diff / 100;
1646 for (i = 0; i < rowscount; i++) {
1647 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
1648 if (rowdata.f_adjust_to_total_100) {
1649 rowdata.f_percentage -= diff;
1650 rowdata.f_amount -= tw * diff / 100;
1651 }
1652 }
1653 } else {
1654 // Adjust all the rows.
1655 var nw = tw * diff / 100;
1656 for (i = 0; i < rowscount; i++) {
1657 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
1658 if (i == row) {
1659 rowdata.f_amount += nw;
1660 } else {
1661 rowdata.f_amount -= nw / (rowscount - 1);
1662 rowdata.f_percentage = Math.round((rowdata.f_amount / tw) * 1000) / 10.0;
1663 }
1664 }
1665 }
1666 }
1667 }
1668 },
1669 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 80,
1670 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) {
1671 if (to_100) {
1672 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
1673 for (i = 0; i < rowscount; i++) {
1674 if (i != row) {
1675 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
1676 rowdata.f_adjust_to_total_100 = false;
1677 }
1678 }
1679 }
1680 }
1681 }
1682 ] 1597 ]
1683 });
1684 $("#fermentableGrid").on('cellendedit', function (event) {
1685 var args = event.args;
1686 console.log("Event Type: cellendedit, Column: " + args.datafield + ", Row: " + (args.rowindex) + ", Value: " + args.value);
1687 // Make sure the grid itself is updated.
1688 $("#fermentableGrid").jqxGrid('setcellvalue', args.rowindex, args.datafield, args.value);
1689 if ((args.datafield == 'f_amount') && (! to_100)) {
1690 // If one of the amounts is changed, recalculate the percentages.
1691 console.log("adjust percentages");
1692 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
1693 if (rowscount > 1) {
1694 var tw = 0;
1695 for (i = 0; i < rowscount; i++) {
1696 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
1697 tw += rowdata.f_amount;
1698 };
1699 for (i = 0; i < rowscount; i++) {
1700 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
1701 var percentage = Math.round(rowdata.f_amount / tw * 1000) / 10.0;
1702 $("#fermentableGrid").jqxGrid('setcellvalue', i, "f_percentage", percentage);
1703 };
1704 } else {
1705 $("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100);
1706 }
1707 };
1708 $('#fermentableGrid').jqxGrid('sortby', 'f_amount', 'desc'); // TODO: not reliable
1709 calcFermentables();
1710 calcSVG();
1711 calcABV();
1712 calcIBUs(); // Depends on gravity, so recalculate.
1713 }); 1598 });
1714 }; 1599 };
1715 1600
1716 // Inline hops editor 1601 // Inline hops editor
1717 var editHop = function (data) { 1602 var editHop = function (data) {
1723 datafields: [ 1608 datafields: [
1724 { name: 'h_name', type: 'string' }, 1609 { name: 'h_name', type: 'string' },
1725 { name: 'h_origin', type: 'string' }, 1610 { name: 'h_origin', type: 'string' },
1726 { name: 'h_amount', type: 'float' }, 1611 { name: 'h_amount', type: 'float' },
1727 { name: 'h_cost', type: 'float' }, 1612 { name: 'h_cost', type: 'float' },
1728 { name: 'h_type', type: 'string' }, 1613 { name: 'h_type', type: 'int' },
1729 { name: 'h_form', type: 'string' }, 1614 { name: 'h_form', type: 'int' },
1730 { name: 'h_useat', type: 'string' }, 1615 { name: 'h_useat', type: 'int' },
1731 { name: 'h_time', type: 'float' }, 1616 { name: 'h_time', type: 'float' },
1732 { name: 'h_alpha', type: 'float' }, 1617 { name: 'h_alpha', type: 'float' },
1733 { name: 'h_beta', type: 'float' }, 1618 { name: 'h_beta', type: 'float' },
1734 { name: 'h_hsi', type: 'float' }, 1619 { name: 'h_hsi', type: 'float' },
1735 { name: 'h_humulene', type: 'float' }, 1620 { name: 'h_humulene', type: 'float' },
1943 async: false, 1828 async: false,
1944 datafields: [ 1829 datafields: [
1945 { name: 'm_name', type: 'string' }, 1830 { name: 'm_name', type: 'string' },
1946 { name: 'm_amount', type: 'float' }, 1831 { name: 'm_amount', type: 'float' },
1947 { name: 'm_cost', type: 'float' }, 1832 { name: 'm_cost', type: 'float' },
1948 { name: 'm_type', type: 'string' }, 1833 { name: 'm_type', type: 'int' },
1949 { name: 'm_use_use', type: 'string' }, 1834 { name: 'm_use_use', type: 'int' },
1950 { name: 'm_time', type: 'float' }, 1835 { name: 'm_time', type: 'float' },
1951 { name: 'm_amount_is_weight', type: 'bool' }, 1836 { name: 'm_amount_is_weight', type: 'int' },
1952 { name: 'm_weight', type: 'float' } 1837 { name: 'm_weight', type: 'float' }
1953 ], 1838 ],
1954 addrow: function (rowid, rowdata, position, commit) { 1839 addrow: function (rowid, rowdata, position, commit) {
1955 commit(true); 1840 commit(true);
1956 }, 1841 },
1973 break; 1858 break;
1974 case 'MgSO4': $("#wa_mgso4").val(row.m_weight); 1859 case 'MgSO4': $("#wa_mgso4").val(row.m_weight);
1975 break; 1860 break;
1976 case 'NaCl': $("#wa_nacl").val(row.m_weight); 1861 case 'NaCl': $("#wa_nacl").val(row.m_weight);
1977 break; 1862 break;
1978 case 'Melkzuur': $("#wa_acid_name").val('Melkzuur'); 1863 case 'Melkzuur': $("#wa_acid_name").val(0);
1979 $("#wa_acid").val(row.m_weight); 1864 $("#wa_acid").val(row.m_weight);
1980 $("#wa_acid_perc").val(80); 1865 $("#wa_acid_perc").val(80);
1981 last_acid = 'Melkzuur'; 1866 last_acid = 0;
1982 break; 1867 break;
1983 case 'Zoutzuur': $("#wa_acid_name").val('Zoutzuur'); 1868 case 'Zoutzuur': $("#wa_acid_name").val(1);
1984 $("#wa_acid").val(row.m_weight); 1869 $("#wa_acid").val(row.m_weight);
1985 $("#wa_acid_perc").val(80); 1870 $("#wa_acid_perc").val(80);
1986 last_acid = 'Zoutzuur'; 1871 last_acid = 1;
1987 break; 1872 break;
1988 case 'Fosforzuur': $("#wa_acid_name").val('Fosforzuur'); 1873 case 'Fosforzuur': $("#wa_acid_name").val(2);
1989 $("#wa_acid").val(row.m_weight); 1874 $("#wa_acid").val(row.m_weight);
1990 $("#wa_acid_perc").val(80); 1875 $("#wa_acid_perc").val(80);
1991 last_acid = 'Fosforzuur'; 1876 last_acid = 2;
1992 break; 1877 break;
1993 case 'Zwavelzuur': $("#wa_acid_name").val('Zwavelzuur'); 1878 case 'Zwavelzuur': $("#wa_acid_name").val(3);
1994 $("#wa_acid").val(row.m_weight); 1879 $("#wa_acid").val(row.m_weight);
1995 $("#wa_acid_perc").val(80); 1880 $("#wa_acid_perc").val(80);
1996 last_acid = 'Zwavelzuur'; 1881 last_acid = 3;
1997 break; 1882 break;
1998 case 'NaHCO3': $("#wa_base_name").val('NaHCO3'); 1883 case 'NaHCO3': $("#wa_base_name").val(0);
1999 $("#wa_base").val(row.m_weight); 1884 $("#wa_base").val(row.m_weight);
2000 last_base = 'NaHCO3'; 1885 last_base = 0;
2001 break; 1886 break;
2002 case 'Na2CO3': $("#wa_base_name").val('Na2CO3'); 1887 case 'Na2CO3': $("#wa_base_name").val(1);
2003 $("#wa_base").val(row.m_weight); 1888 $("#wa_base").val(row.m_weight);
2004 last_base = 'Na2CO3'; 1889 last_base = 1;
2005 break; 1890 break;
2006 case 'CaCO3': $("#wa_base_name").val('CaCO3'); 1891 case 'CaCO3': $("#wa_base_name").val(2);
2007 $("#wa_base").val(row.m_weight); 1892 $("#wa_base").val(row.m_weight);
2008 last_base = 'CaCO3'; 1893 last_base = 2;
2009 break; 1894 break;
2010 case 'Ca(OH)2': $("#wa_base_name").val('Ca(OH)2'); 1895 case 'Ca(OH)2': $("#wa_base_name").val(3);
2011 $("#wa_base").val(row.m_weight); 1896 $("#wa_base").val(row.m_weight);
2012 last_base = 'Ca(OH)2'; 1897 last_base = 3;
2013 break; 1898 break;
2014 } 1899 }
2015 } 1900 }
2016 return data; 1901 return data;
2017 }, 1902 },
2176 { name: 'y_name', type: 'string' }, 2061 { name: 'y_name', type: 'string' },
2177 { name: 'y_laboratory', type: 'string' }, 2062 { name: 'y_laboratory', type: 'string' },
2178 { name: 'y_product_id', type: 'string' }, 2063 { name: 'y_product_id', type: 'string' },
2179 { name: 'y_amount', type: 'float' }, 2064 { name: 'y_amount', type: 'float' },
2180 { name: 'y_cost', type: 'float' }, 2065 { name: 'y_cost', type: 'float' },
2181 { name: 'y_type', type: 'string' }, 2066 { name: 'y_type', type: 'int' },
2182 { name: 'y_form', type: 'string' }, 2067 { name: 'y_form', type: 'int' },
2183 { name: 'y_time', type: 'float' }, 2068 { name: 'y_time', type: 'float' },
2184 { name: 'y_min_temperature', type: 'float' }, 2069 { name: 'y_min_temperature', type: 'float' },
2185 { name: 'y_max_temperature', type: 'float' }, 2070 { name: 'y_max_temperature', type: 'float' },
2186 { name: 'y_attenuation', type: 'float' }, 2071 { name: 'y_attenuation', type: 'float' },
2187 { name: 'y_amount_is_weight', type: 'bool' }, 2072 { name: 'y_amount_is_weight', type: 'int' },
2188 { name: 'y_use', type: 'string' }, 2073 { name: 'y_use', type: 'int' },
2189 { name: 'y_weight', type: 'float' } 2074 { name: 'y_weight', type: 'float' }
2190 ], 2075 ],
2191 addrow: function (rowid, rowdata, position, commit) { 2076 addrow: function (rowid, rowdata, position, commit) {
2192 commit(true); 2077 commit(true);
2193 }, 2078 },
2255 row["y_product_id"] = datarecord.product_id; 2140 row["y_product_id"] = datarecord.product_id;
2256 row["y_type"] = datarecord.type; 2141 row["y_type"] = datarecord.type;
2257 row["y_form"] = datarecord.form; 2142 row["y_form"] = datarecord.form;
2258 row["y_amount"] = 0; 2143 row["y_amount"] = 0;
2259 row["y_cost"] = datarecord.cost; 2144 row["y_cost"] = datarecord.cost;
2260 row["y_use"] = "Primary"; 2145 row["y_use"] = 0;
2261 row["y_time"] = 0; 2146 row["y_time"] = 0;
2262 if (datarecord.form == "Dry") { 2147 if (datarecord.form == 1) {
2263 row["y_amount_is_weight"] = 1; 2148 row["y_amount_is_weight"] = 1;
2264 } else { 2149 } else {
2265 row["y_amount_is_weight"] = 0; 2150 row["y_amount_is_weight"] = 0;
2266 } 2151 }
2267 row["y_min_temperature"] = datarecord.min_temperature; 2152 row["y_min_temperature"] = datarecord.min_temperature;
2351 // inline mash editor 2236 // inline mash editor
2352 var editMash = function (data) { 2237 var editMash = function (data) {
2353 var generaterow = function () { 2238 var generaterow = function () {
2354 var row = {}; 2239 var row = {};
2355 row["step_name"] = "Stap 1"; 2240 row["step_name"] = "Stap 1";
2356 row["step_type"] = "Infusion"; 2241 row["step_type"] = 0;
2357 row["step_infuse_amount"] = 15; 2242 row["step_infuse_amount"] = 15;
2358 row["step_temp"] = 62.0; 2243 row["step_temp"] = 62.0;
2359 row['step_time'] = 20.0; 2244 row['step_time'] = 20.0;
2360 row['ramp_time'] = 1.0; 2245 row['ramp_time'] = 1.0;
2361 row['end_temp'] = 62.0; 2246 row['end_temp'] = 62.0;
2366 datatype: "local", 2251 datatype: "local",
2367 cache: false, 2252 cache: false,
2368 async: false, 2253 async: false,
2369 datafields: [ 2254 datafields: [
2370 { name: 'step_name', type: 'string' }, 2255 { name: 'step_name', type: 'string' },
2371 { name: 'step_type', type: 'string' }, 2256 { name: 'step_type', type: 'int' },
2372 { name: 'step_infuse_amount', type: 'float' }, 2257 { name: 'step_infuse_amount', type: 'float' },
2373 { name: 'step_temp', type: 'float' }, 2258 { name: 'step_temp', type: 'float' },
2374 { name: 'step_time', type: 'float' }, 2259 { name: 'step_time', type: 'float' },
2375 { name: 'ramp_time', type: 'float' }, 2260 { name: 'ramp_time', type: 'float' },
2376 { name: 'end_temp', type: 'float' } 2261 { name: 'end_temp', type: 'float' }
2386 beforeLoadComplete: function (records) { 2271 beforeLoadComplete: function (records) {
2387 mash_infuse = 0; 2272 mash_infuse = 0;
2388 var data = new Array(); 2273 var data = new Array();
2389 for (var i = 0; i < records.length; i++) { 2274 for (var i = 0; i < records.length; i++) {
2390 var row = records[i]; 2275 var row = records[i];
2391 if (row.step_type == 'Infusion') 2276 if (row.step_type == 0) // Infusion
2392 mash_infuse += parseFloat(row.step_infuse_amount); 2277 mash_infuse += parseFloat(row.step_infuse_amount);
2393 } 2278 }
2394 }, 2279 },
2395 }); 2280 });
2396 $("#mashGrid").jqxGrid({ 2281 $("#mashGrid").jqxGrid({
2488 $('#mashGrid').jqxGrid('sortby', 'step_temp', 'asc'); 2373 $('#mashGrid').jqxGrid('sortby', 'step_temp', 'asc');
2489 }); 2374 });
2490 }; 2375 };
2491 2376
2492 // initialize the input fields. 2377 // initialize the input fields.
2493 var srcType = [ "All Grain", "Partial Mash", "Extract" ];
2494 var srcColor = [ "Morey", "Mosher", "Daniels" ];
2495 //var srcIBU = [ "Tinseth", "Rager", "Garetz", "Daniels", "Mosher", "Noonan" ];
2496 var srcIBU = [ "Tinseth", "Rager", "Daniels" ]; // Only these are supported at this time.
2497 var srcBase = [ "NaHCO3", "Na2CO3", "CaCO3", "Ca(OH)2" ]; 2378 var srcBase = [ "NaHCO3", "Na2CO3", "CaCO3", "Ca(OH)2" ];
2498 var srcAcid = [ "Melkzuur", "Zoutzuur", "Fosforzuur", "Zwavelzuur" ]; 2379 var srcAcid = [ "Melkzuur", "Zoutzuur", "Fosforzuur", "Zwavelzuur" ];
2499 var srcSource = [ "Bron 1", "Bron 2", "Gemengd" ]; 2380 var srcSource = [ "Bron 1", "Bron 2", "Gemengd" ];
2381
2382 // Tab 1, Algemeen
2383 $("#name").jqxTooltip({ content: 'De naam voor dit recept.' });
2500 $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); 2384 $("#name").jqxInput({ theme: theme, width: 640, height: 23 });
2501 $("#locked").jqxCheckBox({ theme: theme, width: 120, height: 23 }); 2385 $("#locked").jqxCheckBox({ theme: theme, width: 120, height: 23 });
2386 $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' });
2502 $("#notes").jqxInput({ theme: theme, width: 960, height: 200 }); 2387 $("#notes").jqxInput({ theme: theme, width: 960, height: 200 });
2388 $("#type").jqxTooltip({ content: 'Het brouw type van dit recept.' });
2389 $("#type").jqxDropDownList({
2390 theme: theme,
2391 source: RecipeTypeAdapter,
2392 valueMember: 'id',
2393 displayMember: 'nl',
2394 width: 180,
2395 height: 23,
2396 autoDropDownHeight: true
2397 });
2398 $("#efficiency").jqxTooltip({ content: 'Het rendement van maischen en koken.' });
2399 $("#efficiency").jqxNumberInput( Perc1dec5 );
2400 $("#batch_size").jqxTooltip({ content: 'Het volume van het gekoelde wort na het koken.' });
2401 $("#batch_size").jqxNumberInput( Spin1dec5 );
2402 $("#batch_size").jqxNumberInput({ min: 4 });
2403 $("#boil_size").jqxTooltip({ content: 'Het volume van het wort voor het koken.' });
2404 $("#boil_size").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 2, readOnly: true });
2405 $("#boil_time").jqxTooltip({ content: 'De kooktijd in minuten.' });
2406 $("#boil_time").jqxNumberInput( PosInt );
2407 $("#boil_time").jqxNumberInput({ min: 4, max: 360 });
2408
2409 $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'});
2503 $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 }); 2410 $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 });
2411 $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'});
2504 $("#st_letter").jqxInput({ theme: theme, width: 100, height: 23 }); 2412 $("#st_letter").jqxInput({ theme: theme, width: 100, height: 23 });
2413 $("#st_guide").jqxTooltip({ content: 'De bierstijl gids voor dit recept.'});
2505 $("#st_guide").jqxInput({ theme: theme, width: 250, height: 23 }); 2414 $("#st_guide").jqxInput({ theme: theme, width: 250, height: 23 });
2415 $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'});
2506 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); 2416 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 });
2417 $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'});
2507 $("#st_category_number").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); 2418 $("#st_category_number").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
2508 $("#st_type").jqxInput({ theme: theme, width: 90, height: 23 }); 2419 $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'});
2509 $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 125, height: 23, dropDownHeight: 95 }); 2420 $("#st_type").jqxInput({ theme: theme, width: 180, height: 23 });
2510 $("#batch_size").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: 'L', symbolPosition: 'right' }); 2421
2511 $("#boil_size").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 2, readOnly: true, symbol: 'L', symbolPosition: 'right' }); 2422 $("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
2512 $("#boil_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, max: 360, decimalDigits: 0, spinButtons: true }); 2423 $("#est_og").jqxNumberInput( SGopts );
2513 $("#efficiency").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 40, max: 100, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); 2424 $("#st_og_min").jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'});
2514 $("#est_og").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 1.000, max: 1.200, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 }); 2425 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
2426 $("#st_og_max").jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'});
2427 $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
2428
2429 $("#est_fg").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' });
2430 $("#est_fg").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true });
2431 $("#st_fg_min").jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'});
2432 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
2433 $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'});
2434 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
2435
2436 $("#est_abv").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
2437 $("#est_abv").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
2438 $("#st_abv_min").jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'});
2439 $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
2440 $("#st_abv_max").jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'});
2441 $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
2442
2443 $("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
2444 $("#est_color").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true });
2445 $("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'});
2446 $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
2447 $("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'});
2448 $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
2449 $("#color_method").jqxDropDownList({
2450 theme: theme,
2451 source: ColorMethodAdapter,
2452 valueMember: 'id',
2453 displayMember: 'nl',
2454 width: 180,
2455 height: 23,
2456 autoDropDownHeight: true
2457 });
2458
2459 $("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
2460 $("#est_ibu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true });
2461 $("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'});
2462 $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
2463 $("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'});
2464 $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
2465 $("#ibu_method").jqxDropDownList({
2466 theme: theme,
2467 source: IBUmethodAdapter,
2468 valueMember: 'id',
2469 displayMember: 'nl',
2470 width: 180,
2471 height: 23,
2472 autoDropDownHeight: true,
2473 dropDownVerticalAlignment: 'top'
2474 });
2475
2476 $("#est_carb").jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' });
2477 $("#est_carb").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
2478 $("#st_carb_min").jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'});
2479 $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
2480 $("#st_carb_max").jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'});
2481 $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
2482
2483 // Tab 2, Vergistbaar
2484 $("#est_color2").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
2485 $("#est_color2").jqxNumberInput({ inputMode: 'simple', theme: theme, symbol: ' EBC', symbolPosition: 'right', width: 100, height: 23, decimalDigits: 0, readOnly: true });
2486 $("#est_og2").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
2515 $("#est_og2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 3, readOnly: true }); 2487 $("#est_og2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 3, readOnly: true });
2516 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
2517 $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
2518
2519 $("#est_fg").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 3, readOnly: true });
2520 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
2521 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
2522
2523 $("#est_abv").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
2524 $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
2525 $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
2526
2527 $("#est_color").jqxNumberInput({ inputMode: 'simple', theme: theme, symbol: ' EBC', symbolPosition: 'right', width: 100, height: 23, decimalDigits: 0, readOnly: true });
2528 $("#est_color2").jqxNumberInput({ inputMode: 'simple', theme: theme, symbol: ' EBC', symbolPosition: 'right', width: 100, height: 23, decimalDigits: 0, readOnly: true });
2529 $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
2530 $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
2531 $("#color_method").jqxDropDownList({ theme: theme, source: srcColor, width: 125, height: 23, dropDownHeight: 95 });
2532
2533 $("#est_ibu").jqxNumberInput({ inputMode: 'simple', theme: theme, symbol: ' IBU', symbolPosition: 'right', width: 100, height: 23, decimalDigits: 0, readOnly: true });
2534 $("#est_ibu2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
2535 $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
2536 $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
2537 $("#ibu_method").jqxDropDownList({ theme: theme, source: srcIBU, width: 125, height: 23, dropDownHeight: 95, dropDownVerticalAlignment: 'top' });
2538
2539 $("#est_carb").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
2540 $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
2541 $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
2542
2543 $("#mash_name").jqxInput({ theme: theme, width: 320, height: 23 });
2544 $("#mash_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, max: 8, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 });
2545 // Several gauges
2546 $("#hop_flavour").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true });
2547 $("#hop_aroma").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true });
2548 $("#perc_malts").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); 2488 $("#perc_malts").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true });
2549 $("#perc_sugars").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); 2489 $("#perc_sugars").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true });
2550 $("#perc_cara").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); 2490 $("#perc_cara").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true });
2551 2491 $("#popupFermentable").jqxWindow({
2552 // Water treatment 2492 width: 800,
2493 height: 300,
2494 position: { x: 230, y: 100 },
2495 resizable: false,
2496 theme: theme,
2497 isModal: true,
2498 autoOpen: false,
2499 cancelButton: $("#FermentableReady"),
2500 modalOpacity: 0.40
2501 });
2502 $("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme });
2503 $("#FermentableReady").click(function () {
2504 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_name', $("#wf_name").val());
2505
2506 // $("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
2507 // Recalc percentages
2508 // calcFermentables();
2509 // calcSVG();
2510 // calcABV();
2511 // calcIBUs();
2512 // Waters: yes there is impact.
2513 });
2514 $("#wf_name").jqxInput({ theme: theme, width: 320, height: 23 });
2515 $("#wf_amount").jqxNumberInput( Spin3dec5 );
2516 $('#wf_amount').on('change', function (event) {
2517 console.log("amount changed: "+event.args.value);
2518 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_amount', event.args.value);
2519 if (! to_100) {
2520 // Recalculate percentages
2521 console.log("adjust percentages");
2522 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
2523 if (rowscount > 1) {
2524 var tw = 0;
2525 for (i = 0; i < rowscount; i++) {
2526 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
2527 tw += rowdata.f_amount;
2528 };
2529 for (i = 0; i < rowscount; i++) {
2530 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
2531 var percentage = Math.round(rowdata.f_amount / tw * 1000) / 10.0;
2532 $("#fermentableGrid").jqxGrid('setcellvalue', i, "f_percentage", percentage);
2533 // if (i == fermentableRow) // Will crash the script.
2534 // $("#wf_percentage").val(percentage);
2535 };
2536 } else {
2537 $("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100);
2538 }
2539 calcFermentables();
2540 };
2541 });
2542 $("#wf_percentage").jqxNumberInput( Perc1dec1 );
2543 $("#wf_percentage").on('change', function (event) {
2544 var oldvalue = Math.round(fermentableData.f_percentage * 10) / 10.0;
2545 var newvalue = event.args.value;
2546 console.log("percentage changed: "+newvalue+" old: "+oldvalue);
2547 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
2548 if ((oldvalue != newvalue) && (rowscount > 1)) {
2549 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow);
2550 if (rowdata.f_adjust_to_total_100) {
2551 $("#wf_percentage").val(oldvalue);
2552 } else {
2553 var diff = newvalue - oldvalue;
2554 var tw = 0; // total weight
2555 for (i = 0; i < rowscount; i++) {
2556 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
2557 tw += rowdata.f_amount;
2558 }
2559 if (to_100) {
2560 // Adjust this row and the 100% row.
2561 var damount = tw * diff / 100;
2562 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow);
2563 var namount = rowdata.f_amount + damount;
2564 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_amount', namount);
2565 $("#wf_amount").val(namount);
2566 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_percentage', rowdata.f_percentage + diff);
2567 for (i = 0; i < rowscount; i++) {
2568 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
2569 if (rowdata.f_adjust_to_total_100) {
2570 namount = rowdata.f_amount - damount;
2571 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', rowdata.f_percentage - diff);
2572 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', namount);
2573 }
2574 }
2575 calcFermentables();
2576 } else {
2577 // Adjust all the rows.
2578 var nw = tw * diff / 100;
2579 for (i = 0; i < rowscount; i++) {
2580 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i);
2581 if (i == fermentableRow) {
2582 var namount = rowdata.f_amount + nw;
2583 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', namount);
2584 // $("#wf_amount").val(namount); // Will crash the script.
2585 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', newvalue);
2586 } else {
2587 var namount = rowdata.f_amount - (nw / (rowscount - 1));
2588 var newperc = Math.round((namount / tw) * 1000) / 10.0;
2589 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', namount);
2590 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', newperc);
2591 }
2592 }
2593 calcFermentables();
2594 }
2595 }
2596 }
2597
2598 });
2599 $("#wf_adjust_to_total_100").jqxCheckBox({ theme: theme, width: 120, height: 23 });
2600 $("#wf_adjust_to_total_100").on('checked', function (event) {
2601 if (fermentableData.f_adjust_to_total_100 == 0) {
2602 // console.log("wf_adjust_to_total_100: checked row: "+fermentableRow+" old: "+fermentableData.f_adjust_to_total_100);
2603 if (to_100) {
2604 // Reset other flag first.
2605 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
2606 for (var i = 0; i < rowscount; i++) {
2607 if (i != fermentableRow) {
2608 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_adjust_to_total_100', 0);
2609 }
2610 }
2611 }
2612 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 1);
2613 calcFermentables();
2614 }
2615 });
2616 $("#wf_adjust_to_total_100").on('unchecked', function (event) {
2617 if (fermentableData.f_adjust_to_total_100 != 0) {
2618 // console.log("wf_adjust_to_total_100: unchecked row: "+fermentableRow+" old: "+fermentableData.f_adjust_to_total_100);
2619 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 0);
2620 calcFermentables();
2621 }
2622 });
2623 $("#wf_added").jqxDropDownList({
2624 theme: theme,
2625 source: AddedAdapter,
2626 valueMember: 'id',
2627 displayMember: 'nl',
2628 width: 180,
2629 height: 23,
2630 autoDropDownHeight: true,
2631 dropDownVerticalAlignment: 'top'
2632 });
2633
2634 // Tab 3, Hoppen
2635 $("#est_ibu2").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
2636 $("#est_ibu2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
2637 $("#hop_flavour").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true });
2638 $("#hop_aroma").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true });
2639
2640 // Tab 4, Diversen
2641
2642 // Tab 5, Gist
2643
2644 // Tab 6, Maischen
2645 $("#mash_name").jqxInput({ theme: theme, width: 320, height: 23 });
2646
2647 // Tab 7, Water
2648 $("#tgt_bu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 2, readOnly: true });
2649 $("#tgt_cl_so4").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2650
2651 // Water source 1
2553 $("#w1_name").jqxDropDownList({ 2652 $("#w1_name").jqxDropDownList({
2554 placeHolder: "Kies hoofd water:", 2653 placeHolder: "Kies hoofd water:",
2555 theme: theme, 2654 theme: theme,
2556 source: waterlist, 2655 source: waterlist,
2557 displayMember: "name", 2656 displayMember: "name",
2590 $("#w1_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2689 $("#w1_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2591 $("#w1_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2690 $("#w1_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2592 $("#w1_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2691 $("#w1_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2593 $("#w1_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2692 $("#w1_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2594 $("#w1_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2693 $("#w1_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2595 2694 // Water source 2
2596 $("#w2_name").jqxDropDownList({ 2695 $("#w2_name").jqxDropDownList({
2597 placeHolder: "Kies meng water:", 2696 placeHolder: "Kies meng water:",
2598 theme: theme, 2697 theme: theme,
2599 source: waterlist, 2698 source: waterlist,
2600 displayMember: "name", 2699 displayMember: "name",
2626 dataRecord.w2_cost = datarecord.cost; 2725 dataRecord.w2_cost = datarecord.cost;
2627 $("#w2_amount").jqxNumberInput({ max: 100000, readOnly: false }); // Set high max to enable the spinbuttons. 2726 $("#w2_amount").jqxNumberInput({ max: 100000, readOnly: false }); // Set high max to enable the spinbuttons.
2628 calcWater(); 2727 calcWater();
2629 } 2728 }
2630 }); 2729 });
2730 $("#w2_amount").jqxTooltip({ content: 'De verdeling van het hoofd en meng water. Het totale maisch water volume blijft gelijk.'});
2631 $("#w2_amount").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 94, height: 23, min: 0, max: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5, readOnly: true }); 2731 $("#w2_amount").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 94, height: 23, min: 0, max: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5, readOnly: true });
2632 $("#w2_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2732 $("#w2_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2633 $("#w2_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2733 $("#w2_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2634 $("#w2_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2734 $("#w2_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2635 $("#w2_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2735 $("#w2_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2636 $("#w2_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2736 $("#w2_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2637 $("#w2_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2737 $("#w2_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2638 $("#w2_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2738 $("#w2_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2639 2739 // Water mixed
2640 $("#wg_amount").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2740 $("#wg_amount").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2641 $("#wg_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2741 $("#wg_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2642 $("#wg_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2742 $("#wg_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2643 $("#wg_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2743 $("#wg_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2644 $("#wg_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2744 $("#wg_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2645 $("#wg_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2745 $("#wg_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2646 $("#wg_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2746 $("#wg_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2647 $("#wg_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2747 $("#wg_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2648 2748 // Water treated
2749 $("#wb_calcium").jqxTooltip({ content: 'De ideale hoeveelheid Calcium is tussen 40 en 150.'});
2649 $("#wb_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2750 $("#wb_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2751 $("#wb_magnesium").jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is lager dan 30.'});
2650 $("#wb_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2752 $("#wb_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2753 $("#wb_sodium").jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'});
2651 $("#wb_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2754 $("#wb_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2755 $("#wb_chloride").jqxTooltip({ content: 'De ideale hoeveelheid Chloride is lager dan 100.'});
2756 $("#wb_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2757 $("#wb_sulfate").jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is lager dan 350.'});
2758 $("#wb_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2652 $("#wb_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2759 $("#wb_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2653 $("#wb_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2654 $("#wb_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2655 $("#wb_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2760 $("#wb_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2656 2761 // Water target profile
2657 $("#pr_name").jqxDropDownList({ 2762 $("#pr_name").jqxDropDownList({
2658 placeHolder: "Kies doel profiel:", 2763 placeHolder: "Kies doel profiel:",
2659 theme: theme, 2764 theme: theme,
2660 source: waterprofiles, 2765 source: waterprofiles,
2661 displayMember: "name", 2766 displayMember: "name",
2681 $("#pr_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2786 $("#pr_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2682 $("#pr_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2787 $("#pr_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2683 $("#pr_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2788 $("#pr_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2684 $("#pr_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2789 $("#pr_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true });
2685 2790
2686 $("#tgt_bu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 2, readOnly: true }); 2791 // Water agents
2687 $("#tgt_cl_so4").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); 2792 $("#wa_cacl2").jqxTooltip({ content: 'Voor het maken van een ander waterprofiel. Voegt calcium en chloride toe. Voor het verbeteren van zoetere bieren.'});
2688
2689 $("#wa_cacl2").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, max: 1000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: ' gr', symbolPosition: 'right' }); 2793 $("#wa_cacl2").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, max: 1000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: ' gr', symbolPosition: 'right' });
2794 $("#wa_caso4").jqxTooltip({ content: 'Gips. Voor het maken van een ander waterprofiel. Voegt calcium en sulfaat toe. Voor het verbeteren van bittere bieren.'});
2690 $("#wa_caso4").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, max: 1000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: ' gr', symbolPosition: 'right' }); 2795 $("#wa_caso4").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, max: 1000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: ' gr', symbolPosition: 'right' });
2796 $("#wa_mgso4").jqxTooltip({ content: 'Epsom zout. Voor het maken van een ander waterprofiel. Voegt magnesium en sulfaat toe. Gebruik spaarzaam!'});
2691 $("#wa_mgso4").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, max: 1000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: ' gr', symbolPosition: 'right' }); 2797 $("#wa_mgso4").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, max: 1000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: ' gr', symbolPosition: 'right' });
2798 $("#wa_nacl").jqxTooltip({ content: 'Keukenzout. Voor het maken van een ander waterprofiel. Voegt natrium en chloride toe. Voor het accentueren van zoetheid. Bij hoge dosering wordt het bier ziltig.'});
2692 $("#wa_nacl").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, max: 1000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: ' gr', symbolPosition: 'right' }); 2799 $("#wa_nacl").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, max: 1000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: ' gr', symbolPosition: 'right' });
2693 2800 $("#mash_ph").jqxTooltip({ content: 'Maisch pH tussen 5.2 en 5.6. Gebruik 5.2 voor lichte en 5.5 voor donkere bieren.'});
2801 $("#mash_ph").jqxNumberInput( SpinpH );
2694 $("#calc_acid").jqxCheckBox({ theme: theme, width: 120, height: 23 }); 2802 $("#calc_acid").jqxCheckBox({ theme: theme, width: 120, height: 23 });
2695 $("#wa_base_name").jqxDropDownList({ theme: theme, source: srcBase, width: 100, height: 23, dropDownHeight: 128 }); 2803 $("#wa_base_name").jqxDropDownList({
2804 theme: theme,
2805 source: BaseTypeAdapter,
2806 valueMember: 'id',
2807 displayMember: 'nl',
2808 width: 180,
2809 height: 23,
2810 autoDropDownHeight: true
2811 });
2696 $("#wa_base").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.05, symbol: ' gr', symbolPosition: 'right' }); 2812 $("#wa_base").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.05, symbol: ' gr', symbolPosition: 'right' });
2697 $("#wa_acid_name").jqxDropDownList({ theme: theme, source: srcAcid, width: 100, height: 23, dropDownHeight: 128 }); 2813 $("#wa_acid_name").jqxDropDownList({
2814 theme: theme,
2815 source: AcidTypeAdapter,
2816 valueMember: 'id',
2817 displayMember: 'nl',
2818 width: 180,
2819 height: 23,
2820 autoDropDownHeight: true
2821 });
2698 $("#wa_acid").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.05, symbol: ' ml', symbolPosition: 'right' }); 2822 $("#wa_acid").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.05, symbol: ' ml', symbolPosition: 'right' });
2699 $("#wa_acid_perc").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 80, height: 23, min: 0, max: 100, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); 2823 $("#wa_acid_perc").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 80, height: 23, min: 0, max: 100, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
2700 2824 // Sparge water
2701 $("#sparge_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 70, max: 98, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); 2825 $("#sparge_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 70, max: 98, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 });
2702 $("#sparge_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); 2826 $("#sparge_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 });
2703 $("#sparge_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4.5, max: 6.5, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); 2827 $("#sparge_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4.5, max: 6.5, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 });
2704 $("#sparge_source").jqxDropDownList({ theme: theme, source: srcSource, width: 100, height: 23, dropDownHeight: 95 }); 2828 $("#sparge_source").jqxDropDownList({ theme: theme, source: srcSource, width: 100, height: 23, dropDownHeight: 95 });
2705 $("#sparge_acid_amount").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 2, readOnly: true, symbol: ' ml', symbolPosition: 'right' }); 2829 $("#sparge_acid_amount").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 2, readOnly: true, symbol: ' ml', symbolPosition: 'right' });
2770 locked: $("#locked").val(), 2894 locked: $("#locked").val(),
2771 notes: $("#notes").val(), 2895 notes: $("#notes").val(),
2772 st_name: $('#st_name').val(), 2896 st_name: $('#st_name').val(),
2773 st_letter: $('#st_letter').val(), 2897 st_letter: $('#st_letter').val(),
2774 st_guide: $('#st_guide').val(), 2898 st_guide: $('#st_guide').val(),
2775 st_type: $('#st_type').val(), 2899 st_type: dataRecord.st_type,
2776 st_category: $('#st_category').val(), 2900 st_category: $('#st_category').val(),
2777 st_category_number: parseFloat($("#st_category_number").jqxNumberInput('decimal')), 2901 st_category_number: parseFloat($("#st_category_number").jqxNumberInput('decimal')),
2778 st_og_min: parseFloat($("#st_og_min").jqxNumberInput('decimal')), 2902 st_og_min: parseFloat($("#st_og_min").jqxNumberInput('decimal')),
2779 st_og_max: parseFloat($("#st_og_max").jqxNumberInput('decimal')), 2903 st_og_max: parseFloat($("#st_og_max").jqxNumberInput('decimal')),
2780 st_fg_min: parseFloat($("#st_fg_min").jqxNumberInput('decimal')), 2904 st_fg_min: parseFloat($("#st_fg_min").jqxNumberInput('decimal')),
2828 w2_sodium: parseFloat($("#w2_sodium").jqxNumberInput('decimal')), 2952 w2_sodium: parseFloat($("#w2_sodium").jqxNumberInput('decimal')),
2829 w2_magnesium: parseFloat($("#w2_magnesium").jqxNumberInput('decimal')), 2953 w2_magnesium: parseFloat($("#w2_magnesium").jqxNumberInput('decimal')),
2830 w2_total_alkalinity: parseFloat($("#w2_total_alkalinity").jqxNumberInput('decimal')), 2954 w2_total_alkalinity: parseFloat($("#w2_total_alkalinity").jqxNumberInput('decimal')),
2831 w2_ph: parseFloat($("#w2_ph").jqxNumberInput('decimal')), 2955 w2_ph: parseFloat($("#w2_ph").jqxNumberInput('decimal')),
2832 w2_cost: dataRecord.w2_cost, 2956 w2_cost: dataRecord.w2_cost,
2957 wa_acid_name: $("#wa_acid_name").val(),
2958 wa_acid_perc: parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')),
2959 wa_base_name: $("#wa_base_name").val(),
2833 fermentables: fermentablerow, 2960 fermentables: fermentablerow,
2834 hops: hoprow, 2961 hops: hoprow,
2835 miscs: miscrow, 2962 miscs: miscrow,
2836 yeasts: yeastrow, 2963 yeasts: yeastrow,
2837 mashs: mashrow 2964 mashs: mashrow

mercurial