# HG changeset patch # User Michiel Broek # Date 1575302036 -3600 # Node ID ee76d0bfcdaf7178cc0c106cc1631b3746ec4eb0 # Parent 02898e741df1b60d8cf64ae474f200c08806a6e1 Some code cleanup diff -r 02898e741df1 -r ee76d0bfcdaf www/js/prod_edit.js --- a/www/js/prod_edit.js Mon Dec 02 14:28:55 2019 +0100 +++ b/www/js/prod_edit.js Mon Dec 02 16:53:56 2019 +0100 @@ -1586,7 +1586,7 @@ return 'Wijzig'; }, buttonclick: function(row) { if (dataRecord.stage > 3) { - alert('Het maichen is al gedaan.'); + alert('Het maischen is al gedaan.'); } else { mashRow = row; mashData = $('#mashGrid').jqxGrid('getrowdata', mashRow); @@ -1618,13 +1618,7 @@ */ $('#jqxMenu').jqxMenu('destroy'); console.log('record:' + my_record + ' return:' + my_return + ' theme:' + theme); - $('#jqxLoader').jqxLoader({ - width: 250, - height: 150, - isModal: true, - text: 'Laden product ...', - theme: theme - }); + $('#jqxLoader').jqxLoader({ width: 250, height: 150, isModal: true, text: 'Laden product ...', theme: theme }); /* * Generic functions @@ -2067,10 +2061,10 @@ (row.h_inventory < row.h_amount)) ok_hops = 0; } - total_ibus = Math.round(total_ibus * 10) / 10; - ferm_ibus = Math.round(ferm_ibus * 10) / 10; - hop_flavour = Math.round(hop_flavour * 1000 / 5) / 10; - hop_aroma = Math.round(hop_aroma * 1000 / 6) / 10; + total_ibus = Round(total_ibus, 1); + ferm_ibus = Round(ferm_ibus, 1); + hop_flavour = Round(hop_flavour * 100 / 5, 1); + hop_aroma = Round(hop_aroma * 100 / 6, 1); if (hop_flavour > 100) hop_flavour = 100; if (hop_aroma > 100) @@ -3414,35 +3408,35 @@ // Kegs Pressure = CarbCO2ToPressure(dataRecord.keg_carbonation, dataRecord.keg_carbonation_temp); if (Pressure < 0) - Pressure = 0; + Pressure = 0; dataRecord.keg_pressure = Pressure; $('#keg_pressure').val(Round(Pressure, 1)); dataRecord.keg_priming_amount = 0; dataRecord.keg_priming_total = 0; if (!dataRecord.keg_forced_carb) { - for (i = 0; i < rows.length; i++) { - row = rows[i]; - if (row.f_added == 5) { - SFactor = 1 / ((row.f_yield / 100) * (1 - row.f_moisture / 100)); - dataRecord.keg_priming_amount = CarbCO2toS(dataRecord.keg_carbonation, TSec, SFactor); - dataRecord.keg_priming_total = Round(dataRecord.keg_amount * dataRecord.keg_priming_amount, 2); - $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', dataRecord.keg_priming_total / 1000); - } - } - $('#keg_priming_amount').val(Round(dataRecord.keg_priming_amount, 1)); - $('#keg_priming_total').val(dataRecord.keg_priming_total); - pabv = ABV + dataRecord.keg_priming_amount * 0.47 / 7.907; - pvol = dataRecord.keg_amount - (pabv * dataRecord.keg_amount) / 100; - talc = dataRecord.keg_amount - pvol; - tvol = pvol + dataRecord.keg_priming_water; - kabv = Round(talc / (tvol + talc) * 100, 2); - //console.log("kegs pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.keg_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+kabv); - $('#keg_abv').val(kabv); + for (i = 0; i < rows.length; i++) { + row = rows[i]; + if (row.f_added == 5) { + SFactor = 1 / ((row.f_yield / 100) * (1 - row.f_moisture / 100)); + dataRecord.keg_priming_amount = CarbCO2toS(dataRecord.keg_carbonation, TSec, SFactor); + dataRecord.keg_priming_total = Round(dataRecord.keg_amount * dataRecord.keg_priming_amount, 2); + $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', dataRecord.keg_priming_total / 1000); + } + } + $('#keg_priming_amount').val(Round(dataRecord.keg_priming_amount, 1)); + $('#keg_priming_total').val(dataRecord.keg_priming_total); + pabv = ABV + dataRecord.keg_priming_amount * 0.47 / 7.907; + pvol = dataRecord.keg_amount - (pabv * dataRecord.keg_amount) / 100; + talc = dataRecord.keg_amount - pvol; + tvol = pvol + dataRecord.keg_priming_water; + kabv = Round(talc / (tvol + talc) * 100, 2); + //console.log("kegs pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.keg_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+kabv); + $('#keg_abv').val(kabv); } else { - $('#keg_priming_amount').val(0); - $('#keg_priming_total').val(0); - $('#keg_abv').val(ABV); + $('#keg_priming_amount').val(0); + $('#keg_priming_total').val(0); + $('#keg_abv').val(ABV); } }