463:0efdafd23753 | 464:fbd2a7cecaaa |
---|---|
72 var MMCa = 40.048; | 72 var MMCa = 40.048; |
73 var MMMg = 24.305; | 73 var MMMg = 24.305; |
74 var MMNa = 22.98976928; | 74 var MMNa = 22.98976928; |
75 var MMCl = 35.453; | 75 var MMCl = 35.453; |
76 var MMSO4 = 96.0626; | 76 var MMSO4 = 96.0626; |
77 var MMCO3 = 60.01684; | |
78 var MMHCO3 = 61.01684; | 77 var MMHCO3 = 61.01684; |
79 var MMCaSO4 = 172.171; | 78 var MMCaSO4 = 172.171; |
80 var MMCaCl2 = 147.015; | 79 var MMCaCl2 = 147.015; |
81 var MMCaCO3 = 100.087; | 80 var MMCaCO3 = 100.087; |
82 var MMMgSO4 = 246.475; | 81 var MMMgSO4 = 246.475; |
1084 if (amount == 0) { | 1083 if (amount == 0) { |
1085 for (var i = 0; i < rows.length; i++) { | 1084 for (var i = 0; i < rows.length; i++) { |
1086 var row = rows[i]; | 1085 var row = rows[i]; |
1087 if (row.m_name == name) { | 1086 if (row.m_name == name) { |
1088 var id = $("#miscGrid").jqxGrid('getrowid', i); | 1087 var id = $("#miscGrid").jqxGrid('getrowid', i); |
1089 var commit = $("#miscGrid").jqxGrid('deleterow', id); | 1088 $("#miscGrid").jqxGrid('deleterow', id); |
1090 } | 1089 } |
1091 } | 1090 } |
1092 } else { | 1091 } else { |
1093 var found = false; | 1092 var found = false; |
1094 for (var i = 0; i < rows.length; i++) { | 1093 for (var i = 0; i < rows.length; i++) { |
1114 row["m_use_use"] = record.use_use; | 1113 row["m_use_use"] = record.use_use; |
1115 row["m_time"] = 0; | 1114 row["m_time"] = 0; |
1116 row["m_amount_is_weight"] = record.amount_is_weight; | 1115 row["m_amount_is_weight"] = record.amount_is_weight; |
1117 row["m_inventory"] = record.inventory; | 1116 row["m_inventory"] = record.inventory; |
1118 row["m_avail"] = 1; | 1117 row["m_avail"] = 1; |
1119 var commit = $("#miscGrid").jqxGrid('addrow', null, row); | 1118 $("#miscGrid").jqxGrid('addrow', null, row); |
1120 } | 1119 } |
1121 } | 1120 } |
1122 } | 1121 } |
1123 }); | 1122 }); |
1124 miscs.dataBind(); | 1123 miscs.dataBind(); |
1316 ph = dataRecord.w1_ph; | 1315 ph = dataRecord.w1_ph; |
1317 } | 1316 } |
1318 $('#wg_amount').val(liters); | 1317 $('#wg_amount').val(liters); |
1319 var wg_calcium = calcium; | 1318 var wg_calcium = calcium; |
1320 $('#wg_calcium').val(Math.round(calcium * 10) / 10); | 1319 $('#wg_calcium').val(Math.round(calcium * 10) / 10); |
1321 var wg_magnesium = magnesium; | 1320 //var wg_magnesium = magnesium; |
1322 $('#wg_magnesium').val(Math.round(magnesium * 10) / 10); | 1321 $('#wg_magnesium').val(Math.round(magnesium * 10) / 10); |
1323 var wg_sodium = sodium; | 1322 var wg_sodium = sodium; |
1324 $('#wg_sodium').val(Math.round(sodium * 10) / 10); | 1323 $('#wg_sodium').val(Math.round(sodium * 10) / 10); |
1325 var wg_total_alkalinity = total_alkalinity; | 1324 var wg_total_alkalinity = total_alkalinity; |
1326 $('#wg_total_alkalinity').val(Math.round(total_alkalinity * 10) / 10); | 1325 $('#wg_total_alkalinity').val(Math.round(total_alkalinity * 10) / 10); |
1327 var wg_chloride = chloride; | 1326 var wg_chloride = chloride; |
1328 $('#wg_chloride').val(Math.round(chloride * 10) / 10); | 1327 $('#wg_chloride').val(Math.round(chloride * 10) / 10); |
1329 var wg_sulfate = sulfate; | 1328 var wg_sulfate = sulfate; |
1330 $('#wg_sulfate').val(Math.round(sulfate * 10) / 10); | 1329 $('#wg_sulfate').val(Math.round(sulfate * 10) / 10); |
1331 // Note: brouwhulp has the malts included here in the result. | 1330 // Note: brouwhulp has the malts included here in the result. |
1332 var wg_ph = ph; | 1331 //var wg_ph = ph; |
1333 $('#wg_ph').val(Math.round(ph * 10) / 10); | 1332 $('#wg_ph').val(Math.round(ph * 10) / 10); |
1334 $('#wb_ph').val(Math.round(MashpH() * 10) / 10); | 1333 $('#wb_ph').val(Math.round(MashpH() * 10) / 10); |
1335 $('#est_mash_ph').val(Math.round(MashpH() * 10) / 10); | 1334 $('#est_mash_ph').val(Math.round(MashpH() * 10) / 10); |
1336 bicarbonate = total_alkalinity * 1.22; | 1335 bicarbonate = total_alkalinity * 1.22; |
1337 var wg_bicarbonate = bicarbonate; | 1336 var wg_bicarbonate = bicarbonate; |
1712 // Step 1: Compute the mole fractions of carbonic (f1o), bicarbonate (f2o) and carbonate(f3o) at the water pH | 1711 // Step 1: Compute the mole fractions of carbonic (f1o), bicarbonate (f2o) and carbonate(f3o) at the water pH |
1713 var r1 = Math.pow(10, Source_pH - 6.38); | 1712 var r1 = Math.pow(10, Source_pH - 6.38); |
1714 var r2 = Math.pow(10, Source_pH - 10.373); | 1713 var r2 = Math.pow(10, Source_pH - 10.373); |
1715 var d = 1 + r1 + r1*r2; | 1714 var d = 1 + r1 + r1*r2; |
1716 var f1 = 1/d; | 1715 var f1 = 1/d; |
1717 var f2 = r1/d; | 1716 //var f2 = r1/d; |
1718 var f3 = r1 * r2 / d; | 1717 var f3 = r1 * r2 / d; |
1719 | 1718 |
1720 //Step 2. Compute the mole fractions at pH = 4.3 (the pH which defines alkalinity) | 1719 //Step 2. Compute the mole fractions at pH = 4.3 (the pH which defines alkalinity) |
1721 var r143 = Math.pow(10, 4.3 - 6.38); | 1720 var r143 = Math.pow(10, 4.3 - 6.38); |
1722 var r243 = Math.pow(10, 4.3 - 10.373); | 1721 var r243 = Math.pow(10, 4.3 - 10.373); |
1723 var d43 = 1 + r143 + r143*r243; | 1722 var d43 = 1 + r143 + r143*r243; |
1724 var f143 = 1/d43; | 1723 var f143 = 1/d43; |
1725 var f243 = r143 / d43; | 1724 //var f243 = r143 / d43; |
1726 var f343 = r143 * r243 / d43; | 1725 var f343 = r143 * r243 / d43; |
1727 | 1726 |
1728 //Step 3. Convert the water alkalinity to milliequivalents/L | 1727 //Step 3. Convert the water alkalinity to milliequivalents/L |
1729 var alkalinity = Source_alkalinity / 50; | 1728 var alkalinity = Source_alkalinity / 50; |
1730 | 1729 |
1734 //Step 5. Compute mole fractions at desired pH | 1733 //Step 5. Compute mole fractions at desired pH |
1735 var r1g = Math.pow(10, TargetpH - 6.38); | 1734 var r1g = Math.pow(10, TargetpH - 6.38); |
1736 var r2g = Math.pow(10, TargetpH - 10.373); | 1735 var r2g = Math.pow(10, TargetpH - 10.373); |
1737 var dg = 1 + r1g + r1g*r2g; | 1736 var dg = 1 + r1g + r1g*r2g; |
1738 var f1g = 1/dg; | 1737 var f1g = 1/dg; |
1739 var f2g = r1g / dg; | 1738 //var f2g = r1g / dg; |
1740 var f3g = r1g * r2g / dg; | 1739 var f3g = r1g * r2g / dg; |
1741 | 1740 |
1742 //Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L) | 1741 //Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L) |
1743 var Acid = Ct * ((f1g-f1)+(f3-f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH); //mEq/l | 1742 var Acid = Ct * ((f1g-f1)+(f3-f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH); //mEq/l |
1744 Acid += 0.01; // Add acid that would be required for distilled water. | 1743 Acid += 0.01; // Add acid that would be required for distilled water. |
1774 Acid = Math.round(Acid * 100) / 100; | 1773 Acid = Math.round(Acid * 100) / 100; |
1775 dataRecord.sparge_acid_amount = Acid / 1000; | 1774 dataRecord.sparge_acid_amount = Acid / 1000; |
1776 $("#sparge_acid_amount").val(Acid); | 1775 $("#sparge_acid_amount").val(Acid); |
1777 } | 1776 } |
1778 | 1777 |
1779 function calcFermentation(){ | 1778 function calcFermentation(){ |
1780 if(dataRecord.brew_fermenter_sg<1.020)return; | 1779 |
1781 var obrix=sg_to_brix(dataRecord.brew_fermenter_sg); | 1780 if (dataRecord.brew_fermenter_sg<1.020) |
1782 if((dataRecord.primary_end_sg>0.990)&&(dataRecord.primary_end_sg<dataRecord.brew_fermenter_sg)){ | 1781 return; |
1783 var primary_svg=Round(100*(dataRecord.brew_fermenter_sg-dataRecord.primary_end_sg)/(dataRecord.brew_fermenter_sg-1),1); | 1782 |
1784 $("#primary_svg").val(primary_svg); | 1783 // var obrix = sg_to_brix(dataRecord.brew_fermenter_sg); |
1785 if((dataRecord.secondary_end_sg>0.990)&&(dataRecord.secondary_end_sg<dataRecord.brew_fermenter_sg)){ | 1784 if ((dataRecord.primary_end_sg>0.990)&&(dataRecord.primary_end_sg<dataRecord.brew_fermenter_sg)){ |
1786 var secondary_svg=Round(100*(dataRecord.brew_fermenter_sg-dataRecord.secondary_end_sg)/(dataRecord.brew_fermenter_sg-1),1); | 1785 var primary_svg=Round(100*(dataRecord.brew_fermenter_sg-dataRecord.primary_end_sg)/(dataRecord.brew_fermenter_sg-1),1); |
1787 $("#secondary_svg").val(secondary_svg); | 1786 $("#primary_svg").val(primary_svg); |
1788 if((dataRecord.fg>0.990)&&(dataRecord.fg<dataRecord.brew_fermenter_sg)){ | 1787 if((dataRecord.secondary_end_sg>0.990)&&(dataRecord.secondary_end_sg<dataRecord.brew_fermenter_sg)){ |
1789 var final_svg=Round(100*(dataRecord.brew_fermenter_sg-dataRecord.fg)/(dataRecord.brew_fermenter_sg-1),1); | 1788 var secondary_svg=Round(100*(dataRecord.brew_fermenter_sg-dataRecord.secondary_end_sg)/(dataRecord.brew_fermenter_sg-1),1); |
1790 $("#final_svg").val(final_svg); | 1789 $("#secondary_svg").val(secondary_svg); |
1791 var ABV=Round(abvol(dataRecord.brew_fermenter_sg,dataRecord.fg),2); | 1790 if((dataRecord.fg>0.990)&&(dataRecord.fg<dataRecord.brew_fermenter_sg)){ |
1792 $("#final_abv").val(ABV);}}} | 1791 var final_svg=Round(100*(dataRecord.brew_fermenter_sg-dataRecord.fg)/(dataRecord.brew_fermenter_sg-1),1); |
1793 } | 1792 $("#final_svg").val(final_svg); |
1794 | 1793 var ABV=Round(abvol(dataRecord.brew_fermenter_sg,dataRecord.fg),2); |
1795 function ResCO2(CO2,T){ | 1794 $("#final_abv").val(ABV); |
1796 var F=T*1.8+32; | 1795 } |
1797 return 3.0378-0.050062*F+0.00026555*F*F; | 1796 } |
1798 } | 1797 } |
1799 | 1798 } |
1800 function CarbCO2toS(CO2,T,SFactor){ | 1799 |
1801 var sugar=SFactor*(CO2-ResCO2(CO2,T))/0.286; | 1800 |
1802 if(sugar<0)sugar=0; | 1801 |
1803 return Round(sugar,3); | 1802 function ResCO2(CO2,T){ |
1804 } | 1803 |
1804 var F=T*1.8+32; | |
1805 return 3.0378-0.050062*F+0.00026555*F*F; | |
1806 } | |
1807 | |
1808 | |
1809 | |
1810 function CarbCO2toS(CO2,T,SFactor){ | |
1811 var sugar=SFactor*(CO2-ResCO2(CO2,T))/0.286; | |
1812 if(sugar<0) | |
1813 sugar=0; | |
1814 return Round(sugar,3); | |
1815 } | |
1805 | 1816 |
1806 function GetPressure(CO2, T1, T2) { | 1817 function GetPressure(CO2, T1, T2) { |
1807 var V = CO2 - ResCO2(CO2, T1); | 1818 var V = CO2 - ResCO2(CO2, T1); |
1808 if (V < 0) | 1819 if (V < 0) |
1809 return 0; | 1820 return 0; |
1814 P = 0; | 1825 P = 0; |
1815 P = P * 1.01325; // atm to bar | 1826 P = P * 1.01325; // atm to bar |
1816 return Round(P,1); | 1827 return Round(P,1); |
1817 } | 1828 } |
1818 | 1829 |
1819 function CarbCO2ToPressure(CO2, T) { | 1830 function CarbCO2ToPressure(CO2, T) { |
1820 return (CO2-(-0.000005594056*Math.pow(T,4)+0.000144357886*Math.pow(T,3)+0.000362999168*T*T-0.064872987645*T+1.641145175049)) / | 1831 return (CO2-(-0.000005594056*Math.pow(T,4)+0.000144357886*Math.pow(T,3)+0.000362999168*T*T-0.064872987645*T+1.641145175049)) / |
1821 (0.00000498031*Math.pow(T,4)-0.00024358267*Math.pow(T,3)+0.00385867329*T*T-0.05671206825*T+1.53801423376); | 1832 (0.00000498031*Math.pow(T,4)-0.00024358267*Math.pow(T,3)+0.00385867329*T*T-0.05671206825*T+1.53801423376); |
1822 } | 1833 } |
1823 | 1834 |
1824 function calcCarbonation() { | 1835 function calcCarbonation() { |
1825 var TSec=dataRecord.secondary_temp; | 1836 |
1826 if(TSec<1)TSec=dataRecord.primary_end_temp; | 1837 var TSec=dataRecord.secondary_temp; |
1827 if(TSec<1)TSec=18; | 1838 if(TSec<1) |
1828 if(dataRecord.fg==0.000) | 1839 TSec=dataRecord.primary_end_temp; |
1829 var ABV=abvol(dataRecord.brew_fermenter_sg,parseFloat($("#est_fg").jqxNumberInput('decimal'))); | 1840 if(TSec<1) |
1830 else | 1841 TSec=18; |
1831 var ABV=abvol(dataRecord.brew_fermenter_sg,dataRecord.fg); | 1842 |
1832 /* Calculate new volume and alcohol. */ | 1843 if(dataRecord.fg==0.000) |
1833 var bvol=dataRecord.package_volume-(ABV*dataRecord.package_volume)/100; | 1844 var ABV=abvol(dataRecord.brew_fermenter_sg,parseFloat($("#est_fg").jqxNumberInput('decimal'))); |
1834 var balc=dataRecord.package_volume-bvol; | 1845 else |
1835 var mvol=dataRecord.package_infuse_amount-(dataRecord.package_infuse_abv*dataRecord.package_infuse_amount)/100; | 1846 var ABV=abvol(dataRecord.brew_fermenter_sg,dataRecord.fg); |
1836 var malc=dataRecord.package_infuse_amount-mvol; | 1847 |
1837 var talc=balc+malc; | 1848 /* Calculate new volume and alcohol. */ |
1838 var tvol=bvol+mvol; | 1849 var bvol=dataRecord.package_volume-(ABV*dataRecord.package_volume)/100; |
1839 ABV = Round(talc/(tvol+talc)*100,2); | 1850 var balc=dataRecord.package_volume-bvol; |
1840 dataRecord.package_abv=ABV; | 1851 var mvol=dataRecord.package_infuse_amount-(dataRecord.package_infuse_abv*dataRecord.package_infuse_amount)/100; |
1841 $("#package_abv").val(ABV); | 1852 var malc=dataRecord.package_infuse_amount-mvol; |
1853 var talc=balc+malc; | |
1854 var tvol=bvol+mvol; | |
1855 ABV = Round(talc/(tvol+talc)*100,2); | |
1856 dataRecord.package_abv=ABV; | |
1857 $("#package_abv").val(ABV); | |
1842 | 1858 |
1843 // console.log("calcCarbonation() TSec:"+TSec+" ABV:"+ABV); | 1859 // console.log("calcCarbonation() TSec:"+TSec+" ABV:"+ABV); |
1844 if(!(rows = $('#fermentableGrid').jqxGrid('getrows'))){return;} | 1860 if(!(rows = $('#fermentableGrid').jqxGrid('getrows'))){return;} |
1845 | 1861 |
1846 // Bottles | 1862 // Bottles |
1847 dataRecord.bottle_priming_amount=0; | 1863 dataRecord.bottle_priming_amount=0; |
1848 dataRecord.bottle_priming_total=0; | 1864 dataRecord.bottle_priming_total=0; |
1849 for (var i=0;i<rows.length;i++){ | 1865 for (var i=0;i<rows.length;i++){ |
1850 var row=rows[i]; | 1866 var row=rows[i]; |
1851 if(row.f_added==4){ | 1867 if(row.f_added==4){ |
1852 var SFactor=1/((row.f_yield/100)*(1-row.f_moisture/100)); | 1868 var SFactor=1/((row.f_yield/100)*(1-row.f_moisture/100)); |
1853 dataRecord.bottle_priming_amount=CarbCO2toS(dataRecord.bottle_carbonation,TSec,SFactor); | 1869 dataRecord.bottle_priming_amount=CarbCO2toS(dataRecord.bottle_carbonation,TSec,SFactor); |
1854 dataRecord.bottle_priming_total=Round(dataRecord.bottle_amount*dataRecord.bottle_priming_amount,2); | 1870 dataRecord.bottle_priming_total=Round(dataRecord.bottle_amount*dataRecord.bottle_priming_amount,2); |
1855 $("#fermentableGrid").jqxGrid('setcellvalue',i,'f_amount',dataRecord.bottle_priming_total/1000); | 1871 $("#fermentableGrid").jqxGrid('setcellvalue',i,'f_amount',dataRecord.bottle_priming_total/1000); |
1856 }} | 1872 } |
1857 $("#bottle_priming_amount").val(Round(dataRecord.bottle_priming_amount,1)); | 1873 } |
1858 $("#bottle_priming_total").val(dataRecord.bottle_priming_total); | 1874 $("#bottle_priming_amount").val(Round(dataRecord.bottle_priming_amount,1)); |
1859 var pabv=ABV+dataRecord.bottle_priming_amount*0.47/7.907; | 1875 $("#bottle_priming_total").val(dataRecord.bottle_priming_total); |
1860 var pvol=dataRecord.bottle_amount-(pabv*dataRecord.bottle_amount)/100; | 1876 var pabv=ABV+dataRecord.bottle_priming_amount*0.47/7.907; |
1861 var talc=dataRecord.bottle_amount-pvol; | 1877 var pvol=dataRecord.bottle_amount-(pabv*dataRecord.bottle_amount)/100; |
1862 var tvol=pvol+dataRecord.bottle_priming_water; | 1878 var talc=dataRecord.bottle_amount-pvol; |
1863 var babv = Round(talc/(tvol+talc)*100,2); | 1879 var tvol=pvol+dataRecord.bottle_priming_water; |
1864 //console.log("bottle pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.bottle_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+babv); | 1880 var babv = Round(talc/(tvol+talc)*100,2); |
1865 $("#bottle_abv").val(babv); | 1881 //console.log("bottle pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.bottle_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+babv); |
1866 $("#bottle_pressure").val(GetPressure(dataRecord.bottle_carbonation,TSec,dataRecord.bottle_carbonation_temp)); | 1882 $("#bottle_abv").val(babv); |
1867 | 1883 $("#bottle_pressure").val(GetPressure(dataRecord.bottle_carbonation,TSec,dataRecord.bottle_carbonation_temp)); |
1868 // Kegs | 1884 |
1869 var Pressure=CarbCO2ToPressure(dataRecord.keg_carbonation,dataRecord.keg_carbonation_temp); | 1885 // Kegs |
1870 if(Pressure<0)Pressure=0; | 1886 var Pressure=CarbCO2ToPressure(dataRecord.keg_carbonation,dataRecord.keg_carbonation_temp); |
1871 dataRecord.keg_pressure=Pressure; | 1887 if(Pressure<0)Pressure=0; |
1872 $("#keg_pressure").val(Round(Pressure,1)); | 1888 dataRecord.keg_pressure=Pressure; |
1873 | 1889 $("#keg_pressure").val(Round(Pressure,1)); |
1874 dataRecord.keg_priming_amount=0; | 1890 |
1875 dataRecord.keg_priming_total=0; | 1891 dataRecord.keg_priming_amount=0; |
1876 if(!dataRecord.keg_forced_carb){ | 1892 dataRecord.keg_priming_total=0; |
1877 for(var i=0;i<rows.length;i++){ | 1893 if(!dataRecord.keg_forced_carb){ |
1878 var row=rows[i]; | 1894 for(var i=0;i<rows.length;i++){ |
1879 if(row.f_added==5){ | 1895 var row=rows[i]; |
1880 var SFactor=1/((row.f_yield/100)*(1-row.f_moisture/100)); | 1896 if(row.f_added==5){ |
1881 dataRecord.keg_priming_amount=CarbCO2toS(dataRecord.keg_carbonation,TSec,SFactor); | 1897 var SFactor=1/((row.f_yield/100)*(1-row.f_moisture/100)); |
1882 dataRecord.keg_priming_total=Round(dataRecord.keg_amount*dataRecord.keg_priming_amount,2); | 1898 dataRecord.keg_priming_amount=CarbCO2toS(dataRecord.keg_carbonation,TSec,SFactor); |
1883 $("#fermentableGrid").jqxGrid('setcellvalue',i,'f_amount',dataRecord.keg_priming_total/1000); | 1899 dataRecord.keg_priming_total=Round(dataRecord.keg_amount*dataRecord.keg_priming_amount,2); |
1884 } | 1900 $("#fermentableGrid").jqxGrid('setcellvalue',i,'f_amount',dataRecord.keg_priming_total/1000); |
1885 } | 1901 } |
1886 $("#keg_priming_amount").val(Round(dataRecord.keg_priming_amount,1)); | 1902 } |
1887 $("#keg_priming_total").val(dataRecord.keg_priming_total); | 1903 $("#keg_priming_amount").val(Round(dataRecord.keg_priming_amount,1)); |
1888 var pabv=ABV+dataRecord.keg_priming_amount*0.47/7.907; | 1904 $("#keg_priming_total").val(dataRecord.keg_priming_total); |
1889 var pvol=dataRecord.keg_amount-(pabv*dataRecord.keg_amount)/100; | 1905 var pabv=ABV+dataRecord.keg_priming_amount*0.47/7.907; |
1890 var talc=dataRecord.keg_amount-pvol; | 1906 var pvol=dataRecord.keg_amount-(pabv*dataRecord.keg_amount)/100; |
1891 var tvol=pvol+dataRecord.keg_priming_water; | 1907 var talc=dataRecord.keg_amount-pvol; |
1892 var kabv=Round(talc/(tvol+talc)*100,2); | 1908 var tvol=pvol+dataRecord.keg_priming_water; |
1893 //console.log("kegs pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.keg_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+kabv); | 1909 var kabv=Round(talc/(tvol+talc)*100,2); |
1894 $("#keg_abv").val(kabv); | 1910 //console.log("kegs pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.keg_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+kabv); |
1895 } else { | 1911 $("#keg_abv").val(kabv); |
1896 $("#keg_priming_amount").val(0); | 1912 } else { |
1897 $("#keg_priming_total").val(0); | 1913 $("#keg_priming_amount").val(0); |
1898 $("#keg_abv").val(ABV); | 1914 $("#keg_priming_total").val(0); |
1899 } | 1915 $("#keg_abv").val(ABV); |
1900 } | 1916 } |
1917 } | |
1901 | 1918 |
1902 function calcStage() { | 1919 function calcStage() { |
1903 | 1920 |
1904 var newstage = dataRecord.stage; | 1921 var newstage = dataRecord.stage; |
1905 /* parseFloat$("#brew_date_start").val()) returns the year if it is a valid mysql style date. */ | 1922 /* parseFloat$("#brew_date_start").val()) returns the year if it is a valid mysql style date. */ |
3393 source: fermentableAdapter, | 3410 source: fermentableAdapter, |
3394 theme: theme, | 3411 theme: theme, |
3395 selectionmode: 'singlerow', | 3412 selectionmode: 'singlerow', |
3396 showtoolbar: true, | 3413 showtoolbar: true, |
3397 rendertoolbar: function (toolbar) { | 3414 rendertoolbar: function (toolbar) { |
3398 var me = this; | |
3399 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | 3415 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
3400 toolbar.append(container); | 3416 toolbar.append(container); |
3401 container.append('<div style="float: left; margin-left: 165px;" id="faddrowbutton"></div>'); | 3417 container.append('<div style="float: left; margin-left: 165px;" id="faddrowbutton"></div>'); |
3402 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); | 3418 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
3403 container.append('<div style="float: left; margin-left: 10px;" id="finstockbutton"></div>'); | 3419 container.append('<div style="float: left; margin-left: 10px;" id="finstockbutton"></div>'); |
3458 row["f_percentage"] = 0; | 3474 row["f_percentage"] = 0; |
3459 } | 3475 } |
3460 row["f_di_ph"] = datarecord.di_ph; | 3476 row["f_di_ph"] = datarecord.di_ph; |
3461 row["f_acid_to_ph_57"] = datarecord.acid_to_ph_57; | 3477 row["f_acid_to_ph_57"] = datarecord.acid_to_ph_57; |
3462 row["f_inventory"] = datarecord.inventory; | 3478 row["f_inventory"] = datarecord.inventory; |
3463 var commit = $("#fermentableGrid").jqxGrid('addrow', null, row); | 3479 $("#fermentableGrid").jqxGrid('addrow', null, row); |
3464 } | 3480 } |
3465 }); | 3481 }); |
3466 | 3482 |
3467 $("#finstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); | 3483 $("#finstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); |
3468 $("#finstockbutton").on('change', function (event) { | 3484 $("#finstockbutton").on('change', function (event) { |
3477 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; | 3493 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
3478 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | 3494 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
3479 var id = $("#fermentableGrid").jqxGrid('getrowid', selectedrowindex); | 3495 var id = $("#fermentableGrid").jqxGrid('getrowid', selectedrowindex); |
3480 var percent = $('#fermentableGrid').jqxGrid('getcellvalue', id, "f_percentage"); | 3496 var percent = $('#fermentableGrid').jqxGrid('getcellvalue', id, "f_percentage"); |
3481 var amount = $('#fermentableGrid').jqxGrid('getcellvalue', id, "f_amount"); | 3497 var amount = $('#fermentableGrid').jqxGrid('getcellvalue', id, "f_amount"); |
3482 var commit = $("#fermentableGrid").jqxGrid('deleterow', id); | 3498 $("#fermentableGrid").jqxGrid('deleterow', id); |
3483 } | 3499 } |
3484 rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; | 3500 rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
3485 if (rowscount > 1) { | 3501 if (rowscount > 1) { |
3486 if (to_100) { | 3502 if (to_100) { |
3487 for (var i = 0; i < rowscount; i++) { | 3503 for (var i = 0; i < rowscount; i++) { |
3632 source: hopAdapter, | 3648 source: hopAdapter, |
3633 theme: theme, | 3649 theme: theme, |
3634 selectionmode: 'singlerow', | 3650 selectionmode: 'singlerow', |
3635 showtoolbar: true, | 3651 showtoolbar: true, |
3636 rendertoolbar: function (toolbar) { | 3652 rendertoolbar: function (toolbar) { |
3637 var me = this; | |
3638 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | 3653 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
3639 toolbar.append(container); | 3654 toolbar.append(container); |
3640 container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>'); | 3655 container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>'); |
3641 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); | 3656 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
3642 container.append('<div style="float: left; margin-left: 10px;" id="hinstockbutton"></div>'); | 3657 container.append('<div style="float: left; margin-left: 10px;" id="hinstockbutton"></div>'); |
3679 row["h_caryophyllene"] = datarecord.caryophyllene; | 3694 row["h_caryophyllene"] = datarecord.caryophyllene; |
3680 row["h_cohumulone"] = datarecord.cohumulone; | 3695 row["h_cohumulone"] = datarecord.cohumulone; |
3681 row["h_myrcene"] = datarecord.myrcene; | 3696 row["h_myrcene"] = datarecord.myrcene; |
3682 row["h_total_oil"] = datarecord.total_oil; | 3697 row["h_total_oil"] = datarecord.total_oil; |
3683 row["h_inventory"] = datarecord.inventory; | 3698 row["h_inventory"] = datarecord.inventory; |
3684 var commit = $("#hopGrid").jqxGrid('addrow', null, row); | 3699 $("#hopGrid").jqxGrid('addrow', null, row); |
3685 } | 3700 } |
3686 $("#haddrowbutton").jqxDropDownList('clearSelection'); | 3701 $("#haddrowbutton").jqxDropDownList('clearSelection'); |
3687 }); | 3702 }); |
3688 | 3703 |
3689 $("#hinstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); | 3704 $("#hinstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); |
3697 $("#hdeleterowbutton").on('click', function () { | 3712 $("#hdeleterowbutton").on('click', function () { |
3698 var selectedrowindex = $("#hopGrid").jqxGrid('getselectedrowindex'); | 3713 var selectedrowindex = $("#hopGrid").jqxGrid('getselectedrowindex'); |
3699 var rowscount = $("#hopGrid").jqxGrid('getdatainformation').rowscount; | 3714 var rowscount = $("#hopGrid").jqxGrid('getdatainformation').rowscount; |
3700 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | 3715 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
3701 var id = $("#hopGrid").jqxGrid('getrowid', selectedrowindex); | 3716 var id = $("#hopGrid").jqxGrid('getrowid', selectedrowindex); |
3702 var commit = $("#hopGrid").jqxGrid('deleterow', id); | 3717 $("#hopGrid").jqxGrid('deleterow', id); |
3703 } | 3718 } |
3704 calcIBUs(); | 3719 calcIBUs(); |
3705 }); | 3720 }); |
3706 }, | 3721 }, |
3707 ready: function() { | 3722 ready: function() { |
3900 source: miscAdapter, | 3915 source: miscAdapter, |
3901 theme: theme, | 3916 theme: theme, |
3902 selectionmode: 'singlerow', | 3917 selectionmode: 'singlerow', |
3903 showtoolbar: true, | 3918 showtoolbar: true, |
3904 rendertoolbar: function (toolbar) { | 3919 rendertoolbar: function (toolbar) { |
3905 var me = this; | |
3906 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | 3920 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
3907 toolbar.append(container); | 3921 toolbar.append(container); |
3908 container.append('<div style="float: left; margin-left: 165px;" id="maddrowbutton"></div>'); | 3922 container.append('<div style="float: left; margin-left: 165px;" id="maddrowbutton"></div>'); |
3909 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); | 3923 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
3910 container.append('<div style="float: left; margin-left: 10px;" id="minstockbutton"></div>'); | 3924 container.append('<div style="float: left; margin-left: 10px;" id="minstockbutton"></div>'); |
3933 row["m_type"] = datarecord.type; | 3947 row["m_type"] = datarecord.type; |
3934 row["m_use_use"] = datarecord.use_use; | 3948 row["m_use_use"] = datarecord.use_use; |
3935 row["m_time"] = 0; | 3949 row["m_time"] = 0; |
3936 row["m_amount_is_weight"] = datarecord.amount_is_weight; | 3950 row["m_amount_is_weight"] = datarecord.amount_is_weight; |
3937 row["m_inventory"] = datarecord.inventory; | 3951 row["m_inventory"] = datarecord.inventory; |
3938 var commit = $("#miscGrid").jqxGrid('addrow', null, row); | 3952 $("#miscGrid").jqxGrid('addrow', null, row); |
3939 } | 3953 } |
3940 }); | 3954 }); |
3941 $("#minstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); | 3955 $("#minstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); |
3942 $("#minstockbutton").on('change', function (event) { | 3956 $("#minstockbutton").on('change', function (event) { |
3943 miscinstock = event.args.checked; | 3957 miscinstock = event.args.checked; |
3949 var selectedrowindex = $("#miscGrid").jqxGrid('getselectedrowindex'); | 3963 var selectedrowindex = $("#miscGrid").jqxGrid('getselectedrowindex'); |
3950 var rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount; | 3964 var rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount; |
3951 var type = $("#miscGrid").jqxGrid('getcellvalue', selectedrowindex, "m_type"); | 3965 var type = $("#miscGrid").jqxGrid('getcellvalue', selectedrowindex, "m_type"); |
3952 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != 4) { // Water agent | 3966 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != 4) { // Water agent |
3953 var id = $("#miscGrid").jqxGrid('getrowid', selectedrowindex); | 3967 var id = $("#miscGrid").jqxGrid('getrowid', selectedrowindex); |
3954 var commit = $("#miscGrid").jqxGrid('deleterow', id); | 3968 $("#miscGrid").jqxGrid('deleterow', id); |
3955 } | 3969 } |
3956 }); | 3970 }); |
3957 }, | 3971 }, |
3958 ready: function() { | 3972 ready: function() { |
3959 calcMiscs(); | 3973 calcMiscs(); |
4081 source: yeastAdapter, | 4095 source: yeastAdapter, |
4082 theme: theme, | 4096 theme: theme, |
4083 selectionmode: 'singlerow', | 4097 selectionmode: 'singlerow', |
4084 showtoolbar: true, | 4098 showtoolbar: true, |
4085 rendertoolbar: function (toolbar) { | 4099 rendertoolbar: function (toolbar) { |
4086 var me = this; | |
4087 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | 4100 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
4088 toolbar.append(container); | 4101 toolbar.append(container); |
4089 container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>'); | 4102 container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>'); |
4090 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); | 4103 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
4091 container.append('<div style="float: left; margin-left: 10px;" id="yinstockbutton"></div>'); | 4104 container.append('<div style="float: left; margin-left: 10px;" id="yinstockbutton"></div>'); |
4125 row["y_attenuation"] = datarecord.attenuation; | 4138 row["y_attenuation"] = datarecord.attenuation; |
4126 row["y_flocculation"] = datarecord.flocculation; | 4139 row["y_flocculation"] = datarecord.flocculation; |
4127 row["y_cells"] = datarecord.cells; | 4140 row["y_cells"] = datarecord.cells; |
4128 row["y_tolerance"] = datarecord.tolerance; | 4141 row["y_tolerance"] = datarecord.tolerance; |
4129 row["y_inventory"] = datarecord.inventory; | 4142 row["y_inventory"] = datarecord.inventory; |
4130 var commit = $("#yeastGrid").jqxGrid('addrow', null, row); | 4143 $("#yeastGrid").jqxGrid('addrow', null, row); |
4131 } | 4144 } |
4132 calcYeast(); | 4145 calcYeast(); |
4133 $("#yaddrowbutton").jqxDropDownList('clearSelection'); | 4146 $("#yaddrowbutton").jqxDropDownList('clearSelection'); |
4134 }); | 4147 }); |
4135 $("#yinstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); | 4148 $("#yinstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); |
4142 $("#ydeleterowbutton").on('click', function () { | 4155 $("#ydeleterowbutton").on('click', function () { |
4143 var selectedrowindex = $("#yeastGrid").jqxGrid('getselectedrowindex'); | 4156 var selectedrowindex = $("#yeastGrid").jqxGrid('getselectedrowindex'); |
4144 var rowscount = $("#yeastGrid").jqxGrid('getdatainformation').rowscount; | 4157 var rowscount = $("#yeastGrid").jqxGrid('getdatainformation').rowscount; |
4145 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | 4158 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
4146 var id = $("#yeastGrid").jqxGrid('getrowid', selectedrowindex); | 4159 var id = $("#yeastGrid").jqxGrid('getrowid', selectedrowindex); |
4147 var commit = $("#yeastGrid").jqxGrid('deleterow', id); | 4160 $("#yeastGrid").jqxGrid('deleterow', id); |
4148 calcYeast(); | 4161 calcYeast(); |
4149 } | 4162 } |
4150 }); | 4163 }); |
4151 }, | 4164 }, |
4152 ready: function() { | 4165 ready: function() { |
4291 source: mashAdapter, | 4304 source: mashAdapter, |
4292 theme: theme, | 4305 theme: theme, |
4293 selectionmode: 'singlerow', | 4306 selectionmode: 'singlerow', |
4294 showtoolbar: true, | 4307 showtoolbar: true, |
4295 rendertoolbar: function (toolbar) { | 4308 rendertoolbar: function (toolbar) { |
4296 var me = this; | |
4297 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | 4309 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
4298 toolbar.append(container); | 4310 toolbar.append(container); |
4299 container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />'); | 4311 container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />'); |
4300 container.append('<input style="float: left; margin-left: 565px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />'); | 4312 container.append('<input style="float: left; margin-left: 565px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />'); |
4301 $("#saddrowbutton").jqxButton({ template: "primary", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); | 4313 $("#saddrowbutton").jqxButton({ template: "primary", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
4312 row["step_temp"] = 62.0; | 4324 row["step_temp"] = 62.0; |
4313 row['step_time'] = 20.0; | 4325 row['step_time'] = 20.0; |
4314 row['step_thickness'] = 0; | 4326 row['step_thickness'] = 0; |
4315 row['ramp_time'] = 1.0; | 4327 row['ramp_time'] = 1.0; |
4316 row['end_temp'] = 62.0; | 4328 row['end_temp'] = 62.0; |
4317 var commit = $("#mashGrid").jqxGrid('addrow', null, row); | 4329 $("#mashGrid").jqxGrid('addrow', null, row); |
4318 }); | 4330 }); |
4319 // delete selected step. | 4331 // delete selected step. |
4320 $("#sdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); | 4332 $("#sdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
4321 $("#sdeleterowbutton").on('click', function () { | 4333 $("#sdeleterowbutton").on('click', function () { |
4322 var selectedrowindex = $("#mashGrid").jqxGrid('getselectedrowindex'); | 4334 var selectedrowindex = $("#mashGrid").jqxGrid('getselectedrowindex'); |
4323 var rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount; | 4335 var rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount; |
4324 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | 4336 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
4325 var id = $("#mashGrid").jqxGrid('getrowid', selectedrowindex); | 4337 var id = $("#mashGrid").jqxGrid('getrowid', selectedrowindex); |
4326 var commit = $("#mashGrid").jqxGrid('deleterow', id); | 4338 $("#mashGrid").jqxGrid('deleterow', id); |
4327 } | 4339 } |
4328 }); | 4340 }); |
4329 }, | 4341 }, |
4330 ready: function() { | 4342 ready: function() { |
4331 calcInit(); | 4343 calcInit(); |
5322 } | 5334 } |
5323 $("#mashGrid").jqxGrid('deleterow', rowIDs); | 5335 $("#mashGrid").jqxGrid('deleterow', rowIDs); |
5324 // Then add the new steps | 5336 // Then add the new steps |
5325 var datarecord = mashlist.records[index]; | 5337 var datarecord = mashlist.records[index]; |
5326 $("#mash_name").val(datarecord.name); | 5338 $("#mash_name").val(datarecord.name); |
5327 for (var i = 0; i < datarecord.steps.length; i++) { | 5339 for (i = 0; i < datarecord.steps.length; i++) { |
5328 var data = datarecord.steps[i]; | 5340 var data = datarecord.steps[i]; |
5329 var row = {}; | 5341 var row = {}; |
5330 row["step_name"] = data.step_name; | 5342 row["step_name"] = data.step_name; |
5331 row["step_type"] = data.step_type; | 5343 row["step_type"] = data.step_type; |
5332 // For now, but this must be smarter. | 5344 // For now, but this must be smarter. |
5342 row['step_thickness'] = 0; | 5354 row['step_thickness'] = 0; |
5343 row["step_temp"] = data.step_temp; | 5355 row["step_temp"] = data.step_temp; |
5344 row["end_temp"] = data.end_temp; | 5356 row["end_temp"] = data.end_temp; |
5345 row["step_time"] = data.step_time; | 5357 row["step_time"] = data.step_time; |
5346 row["ramp_time"] = data.ramp_time; | 5358 row["ramp_time"] = data.ramp_time; |
5347 var commit = $("#mashGrid").jqxGrid('addrow', null, row); | 5359 $("#mashGrid").jqxGrid('addrow', null, row); |
5348 } | 5360 } |
5349 } | 5361 } |
5350 }); | 5362 }); |
5351 $("#popupMash").jqxWindow({ | 5363 $("#popupMash").jqxWindow({ |
5352 width: 800, | 5364 width: 800, |