# HG changeset patch # User Michiel Broek # Date 1543596039 -3600 # Node ID ac993ef43b1315df3f59ac9fac3330c5b60ff5cc # Parent ad31f4bd4036da9ef4e37e503d0c5ad28d9b65bc Removed all calculations from the equipemnts database script and added missing fields. Added missing fields to the inventory equipemnts edit screen. Added conditional batch size calculation to the equipments editor. Added specific heat settings to the equipments editor. diff -r ad31f4bd4036 -r ac993ef43b13 www/includes/db_inventory_equipments.php --- a/www/includes/db_inventory_equipments.php Thu Nov 29 23:21:42 2018 +0100 +++ b/www/includes/db_inventory_equipments.php Fri Nov 30 17:40:39 2018 +0100 @@ -22,21 +22,11 @@ } $sql .= "name='" . mysqli_real_escape_string($connect, $_GET['name']); $sql .= "', boil_size='" . $_GET['boil_size']; - $batch = '$_GET[\'boil_size\'] - ($_GET[\'evap_rate\'] * ($_GET[\'boil_time\'] / 60))'; - $sql .= "', batch_size='" . eval('return ' . $batch . ';'); + $sql .= "', batch_size='" . $_GET['batch_size']; $sql .= "', tun_volume='" . $_GET['tun_volume']; $sql .= "', tun_weight='" . $_GET['tun_weight']; - $material = mysqli_real_escape_string($connect, $_GET['tun_material']); - if ($material == "RVS") { - $sql .= "', tun_specific_heat='0.11"; - } else if ($material == "Aluminium") { - $sql .= "', tun_specific_heat='0.22"; - } else if ($material == "Kunststof") { - $sql .= "', tun_specific_heat='0.46"; - } else if ($material == "Koper") { - $sql .= "', tun_specific_heat='0.092"; - } - $sql .= "', tun_material='" . $material; + $sql .= "', tun_specific_heat='" . $_GET['tun_specific_heat']; + $sql .= "', tun_material='" . mysqli_real_escape_string($connect, $_GET['tun_material']); $sql .= "', tun_height='" . $_GET['tun_height'] / 100.0; $sql .= "', top_up_water='" . $_GET['top_up_water']; $sql .= "', trub_chiller_loss='" . $_GET['trub_chiller_loss']; @@ -57,7 +47,7 @@ $sql .= "';"; } if (isset($_GET['update'])) { - $sql .= "' WHERE record='" . $_GET['record'] . "';"; + $sql .= "' WHERE record='" . $_GET['record'] . "';"; } $result = mysqli_query($connect, $sql); if (! $result) { diff -r ad31f4bd4036 -r ac993ef43b13 www/inv_equipments.php --- a/www/inv_equipments.php Thu Nov 29 23:21:42 2018 +0100 +++ b/www/inv_equipments.php Fri Nov 30 17:40:39 2018 +0100 @@ -16,7 +16,9 @@ - + + + @@ -51,38 +53,44 @@ - - + + - + + + + + + + - - - - - - + + + + + - + + - - + + diff -r ad31f4bd4036 -r ac993ef43b13 www/js/inv_equipments.js --- a/www/js/inv_equipments.js Thu Nov 29 23:21:42 2018 +0100 +++ b/www/js/inv_equipments.js Fri Nov 30 17:40:39 2018 +0100 @@ -43,6 +43,19 @@ $(document).ready(function () { + + function calcBatchVolume() { + var calc = $("#calc_boil_volume").val(); + var boil_size = parseFloat($("#boil_size").jqxNumberInput('decimal')); + var evap_rate = parseFloat($("#evap_rate").jqxNumberInput('decimal')); + var boil_time = parseFloat($("#boil_time").jqxNumberInput('decimal')); + + if (calc) { // If checked, calculate the batch size. + var batch = boil_size - (evap_rate * boil_time / 60); + $("#batch_size").val(batch); + } + } + var url = "includes/db_inventory_equipments.php"; // tooltips $("#name").jqxTooltip({ content: 'The unique name of this brew equipment.' }); @@ -77,19 +90,22 @@ { name: 'batch_size', type: 'float' }, { name: 'tun_volume', type: 'float' }, { name: 'tun_weight', type: 'float' }, + { name: 'tun_specific_heat', type: 'float' }, + { name: 'tun_material', type: 'string' }, + { name: 'tun_height', type: 'float' }, + { name: 'top_up_water', type: 'float' }, { name: 'trub_chiller_loss', type: 'float' }, { name: 'evap_rate', type: 'float' }, { name: 'boil_time', type: 'float' }, - { name: 'lauter_deadspace', type: 'float' }, + { name: 'calc_boil_volume', type: 'bool' }, { name: 'top_up_kettle', type: 'float' }, { name: 'hop_utilization', type: 'float' }, { name: 'notes', type: 'string' }, { name: 'lauter_volume', type: 'float' }, + { name: 'lauter_height', type: 'float' }, + { name: 'lauter_deadspace', type: 'float' }, { name: 'kettle_volume', type: 'float' }, - { name: 'tun_material', type: 'string' }, - { name: 'tun_height', type: 'float' }, { name: 'kettle_height', type: 'float' }, - { name: 'lauter_height', type: 'float' }, { name: 'mash_volume', type: 'float' }, { name: 'efficiency', type: 'float' } ], @@ -148,25 +164,34 @@ var srcMaterial= [ "RVS", "Aluminium", "Kunststof", "Koper" ]; $("#name").jqxInput({ theme: theme, width: 250, height: 23 }); - $("#boil_size").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); - $("#batch_size").jqxNumberInput({ inputMode: 'simple', readOnly: 'true', theme: theme, width: 50, height: 23, min: 0, decimalDigits: 1 }); - $("#tun_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); - $("#tun_weight").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 2, spinButtons: true }); - $("#trub_chiller_loss").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); - $("#evap_rate").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.05 }); - $("#boil_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 0, spinButtons: true }); - $("#lauter_deadspace").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); - $("#top_up_kettle").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); - $("#hop_utilization").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 0, spinButtons: true }); + $("#boil_size").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); + $("#batch_size").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.5 }); + $("#tun_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); + $("#tun_weight").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 2, spinButtons: true }); + $("#tun_specific_heat").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 3 }); + $("#tun_material").jqxDropDownList({ theme: theme, source: srcMaterial, selectedIndex: 0, width: 110, height: 23, dropDownHeight: 130 }); + $("#tun_height").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); + $("#top_up_water").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#trub_chiller_loss").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#evap_rate").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.05 }); + $("#boil_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 0, spinButtons: true }); + $("#calc_boil_volume").jqxCheckBox({ theme: theme, width: 120, height: 23 }); + $("#calc_boil_volume").on('checked', function (event) { + $("#batch_size").jqxNumberInput({ readOnly: true, width: 70, spinButtons: false }); + }); + $("#calc_boil_volume").on('unchecked', function (event) { + $("#batch_size").jqxNumberInput({ readOnly: false, width: 90, spinButtons: true }); + }); + $("#top_up_kettle").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#hop_utilization").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 0, spinButtons: true }); $("#notes").jqxInput({ theme: theme, width: 640, height: 100 }); - $("#lauter_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); - $("#kettle_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); - $("#tun_material").jqxDropDownList({ theme: theme, source: srcMaterial, selectedIndex: 0, width: 110, height: 23, dropDownHeight: 130 }); - $("#tun_height").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); - $("#kettle_height").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); - $("#lauter_height").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); - $("#mash_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); - $("#efficiency").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); + $("#lauter_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); + $("#lauter_height").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); + $("#lauter_deadspace").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#kettle_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); + $("#kettle_height").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); + $("#mash_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); + $("#efficiency").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); var dataAdapter = new $.jqx.dataAdapter(source); var editrow = -1; // initialize jqxGrid @@ -192,19 +217,22 @@ $("#batch_size").val('15.3'); $("#tun_volume").val('20'); $("#tun_weight").val('2'); + $("#tun_specific_heat").val('0.11'); + $("#tun_material").val('RVS'); + $("#tun_height").val('20'); + $("#top_up_water").val('0'); $("#trub_chiller_loss").val('0.5'); $("#evap_rate").val('1.8'); $("#boil_time").val('90'); - $("#lauter_deadspace").val('0.5'); + $("#calc_boil_volume").val('0'); $("#top_up_kettle").val('0'); $("#hop_utilization").val('100'); $("#notes").val(''); $("#lauter_volume").val('20'); + $("#lauter_height").val('20'); + $("#lauter_deadspace").val('0.5'); $("#kettle_volume").val('20'); - $("#tun_material").val('RVS'); - $("#tun_height").val('20'); $("#kettle_height").val('20'); - $("#lauter_height").val('20'); $("#mash_volume").val('18'); $("#efficiency").val('75'); $("#popupWindow").jqxWindow('open'); @@ -212,6 +240,24 @@ }, filterable: true, filtermode: 'excel', + ready: function() { + $('#boil_size').on('change', function (event) { calcBatchVolume(); }); + $('#evap_rate').on('change', function (event) { calcBatchVolume(); }); + $('#boil_time').on('change', function (event) { calcBatchVolume(); }); + $("#calc_boil_volume").on('change', function (event) { calcBatchVolume(); }); + $('#tun_material').on('change', function (event) { + switch ($('#tun_material').val()) { + case 'RVS': $("#tun_specific_heat").val('0.11'); + break; + case 'Aluminium': $("#tun_specific_heat").val('0.22'); + break; + case 'Kunststof': $("#tun_specific_heat").val('0.46'); + break; + case 'Koper': $("#tun_specific_heat").val('0.092'); + break; + } + }); + }, columns: [ { text: 'Installatie naam', datafield: 'name', width: 200 }, { text: 'Kook volume', datafield: 'boil_size', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, @@ -230,19 +276,22 @@ $("#batch_size").val(dataRecord.batch_size); $("#tun_volume").val(dataRecord.tun_volume); $("#tun_weight").val(dataRecord.tun_weight); + $("#tun_specific_heat").val(dataRecord.tun_specific_heat); + $("#tun_material").val(dataRecord.tun_material); + $("#tun_height").val(dataRecord.tun_height); + $("#top_up_water").val(dataRecord.top_up_water); $("#trub_chiller_loss").val(dataRecord.trub_chiller_loss); $("#evap_rate").val(dataRecord.evap_rate); $("#boil_time").val(dataRecord.boil_time); - $("#lauter_deadspace").val(dataRecord.lauter_deadspace); + $("#calc_boil_volume").val(dataRecord.calc_boil_volume); $("#top_up_kettle").val(dataRecord.top_up_kettle); $("#hop_utilization").val(dataRecord.hop_utilization); $("#notes").val(dataRecord.notes); $("#lauter_volume").val(dataRecord.lauter_volume); + $("#lauter_height").val(dataRecord.lauter_height); + $("#lauter_deadspace").val(dataRecord.lauter_deadspace); $("#kettle_volume").val(dataRecord.kettle_volume); - $("#tun_material").val(dataRecord.tun_material); - $("#tun_height").val(dataRecord.tun_height); $("#kettle_height").val(dataRecord.kettle_height); - $("#lauter_height").val(dataRecord.lauter_height); $("#mash_volume").val(dataRecord.mash_volume); $("#efficiency").val(dataRecord.efficiency); // show the popup window. @@ -283,19 +332,22 @@ batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), tun_volume: parseFloat($("#tun_volume").jqxNumberInput('decimal')), tun_weight: parseFloat($("#tun_weight").jqxNumberInput('decimal')), + tun_specific_heat: parseFloat($("#tun_specific_heat").jqxNumberInput('decimal')), + tun_material: $("#tun_material").val(), + tun_height: parseFloat($("#tun_height").jqxNumberInput('decimal')), + top_up_water: parseFloat($("#top_up_water").jqxNumberInput('decimal')), trub_chiller_loss: parseFloat($("#trub_chiller_loss").jqxNumberInput('decimal')), evap_rate: parseFloat($("#evap_rate").jqxNumberInput('decimal')), boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), - lauter_deadspace: parseFloat($("#lauter_deadspace").jqxNumberInput('decimal')), + calc_boil_volume: $("#calc_boil_volume").val(), top_up_kettle: parseFloat($("#top_up_kettle").jqxNumberInput('decimal')), hop_utilization: parseFloat($("#hop_utilization").jqxNumberInput('decimal')), notes: $("#notes").val(), lauter_volume: parseFloat($("#lauter_volume").jqxNumberInput('decimal')), + lauter_height: parseFloat($("#lauter_height").jqxNumberInput('decimal')), + lauter_deadspace: parseFloat($("#lauter_deadspace").jqxNumberInput('decimal')), kettle_volume: parseFloat($("#kettle_volume").jqxNumberInput('decimal')), - tun_material: $("#tun_material").val(), - tun_height: parseFloat($("#tun_height").jqxNumberInput('decimal')), kettle_height: parseFloat($("#kettle_height").jqxNumberInput('decimal')), - lauter_height: parseFloat($("#lauter_height").jqxNumberInput('decimal')), mash_volume: parseFloat($("#mash_volume").jqxNumberInput('decimal')), efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')) }; @@ -310,19 +362,22 @@ batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), tun_volume: parseFloat($("#tun_volume").jqxNumberInput('decimal')), tun_weight: parseFloat($("#tun_weight").jqxNumberInput('decimal')), + tun_specific_heat: parseFloat($("#tun_specific_heat").jqxNumberInput('decimal')), + tun_material: $("#tun_material").val(), + tun_height: parseFloat($("#tun_height").jqxNumberInput('decimal')), + top_up_water: parseFloat($("#top_up_water").jqxNumberInput('decimal')), trub_chiller_loss: parseFloat($("#trub_chiller_loss").jqxNumberInput('decimal')), evap_rate: parseFloat($("#evap_rate").jqxNumberInput('decimal')), boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), - lauter_deadspace: parseFloat($("#lauter_deadspace").jqxNumberInput('decimal')), + calc_boil_volume: $("#calc_boil_volume").val(), top_up_kettle: parseFloat($("#top_up_kettle").jqxNumberInput('decimal')), hop_utilization: parseFloat($("#hop_utilization").jqxNumberInput('decimal')), notes: $("#notes").val(), lauter_volume: parseFloat($("#lauter_volume").jqxNumberInput('decimal')), + lauter_height: parseFloat($("#lauter_height").jqxNumberInput('decimal')), + lauter_deadspace: parseFloat($("#lauter_deadspace").jqxNumberInput('decimal')), kettle_volume: parseFloat($("#kettle_volume").jqxNumberInput('decimal')), - tun_material: $("#tun_material").val(), - tun_height: parseFloat($("#tun_height").jqxNumberInput('decimal')), kettle_height: parseFloat($("#kettle_height").jqxNumberInput('decimal')), - lauter_height: parseFloat($("#lauter_height").jqxNumberInput('decimal')), mash_volume: parseFloat($("#mash_volume").jqxNumberInput('decimal')), efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')) };
Installatie naam:Bereken kook volume:
Opmerkingen:
Maischwater l:
Maischkuip specific heat:
Kooktijd in minuten:
FilterenMaischwater l:
Extra water bij koken l:
FilterenHopfactor %:
Filter volume l:
Hopfactor %:
Filterkuip hoogte cm:
Volume eind koken l:
Filterkuip hoogte cm:
Koelen
Filterkuip verlies l:
KoelenTrub verlies kookketel l:
Brouwzaalrendement %:
Trub verlies kookketel l:
Extra water in het gistvat l: