Sat, 26 Jan 2019 15:03:09 +0100
Import set tun_material from the specifix heat value. Equipment database uses POST instead of GET. Equipment editor screen in style with other inventory screens. In stock print now uses the type indexes to translate to text. Also show the correct unit and values of the yeast.
--- a/www/import/from_brouwhulp.php Sat Jan 26 11:59:15 2019 +0100 +++ b/www/import/from_brouwhulp.php Sat Jan 26 15:03:09 2019 +0100 @@ -447,7 +447,16 @@ $sql .= "', tun_volume='" . floatval($equipment->TUN_VOLUME); $sql .= "', tun_weight='" . floatval($equipment->TUN_WEIGHT); $sql .= "', tun_specific_heat='" . floatval($equipment->TUN_SPECIFIC_HEAT); - $sql .= "', tun_material='" . mysqli_real_escape_string($db, $equipment->TUN_MATERIAL); + if (floatval($equipment->TUN_SPECIFIC_HEAT) == 0.11) + $sql .= "', tun_material='0"; + else if (floatval($equipment->TUN_SPECIFIC_HEAT) == 0.22) + $sql .= "', tun_material='1"; + else if (floatval($equipment->TUN_SPECIFIC_HEAT) == 0.46) + $sql .= "', tun_material='2"; + else if (floatval($equipment->TUN_SPECIFIC_HEAT) == 0.092) + $sql .= "', tun_material='3"; + else + echo "Unknown TUN_SPECIFIC_HEAT" . $equipment->TUN_SPECIFIC_HEAT . PHP_EOL; $sql .= "', tun_height='" . floatval($equipment->TUN_HEIGHT); $sql .= "', top_up_water='" . floatval($equipment->TOP_UP_WATER); $sql .= "', trub_chiller_loss='" . floatval($equipment->TRUB_CHILLER_LOSS);
--- a/www/includes/db_inventory_equipments.php Sat Jan 26 11:59:15 2019 +0100 +++ b/www/includes/db_inventory_equipments.php Sat Jan 26 15:03:09 2019 +0100 @@ -9,53 +9,51 @@ } mysqli_set_charset($connect, "utf8" ); -// get data and store in a json array -$query = "SELECT * FROM inventory_equipments ORDER BY name"; -if (isset($_GET['insert']) || isset($_GET['update'])) { - if (isset($_GET['insert'])) { +if (isset($_POST['insert']) || isset($_POST['update'])) { + if (isset($_POST['insert'])) { // INSERT COMMAND $sql = "INSERT INTO `inventory_equipments` SET "; } - if (isset($_GET['update'])) { + if (isset($_POST['update'])) { // UPDATE COMMAND $sql = "UPDATE `inventory_equipments` SET "; } - $sql .= "name='" . mysqli_real_escape_string($connect, $_GET['name']); - $sql .= "', boil_size='" . $_GET['boil_size']; - $sql .= "', batch_size='" . $_GET['batch_size']; - $sql .= "', tun_volume='" . $_GET['tun_volume']; - $sql .= "', tun_weight='" . $_GET['tun_weight']; - $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']; - $sql .= "', evap_rate='" . $_GET['evap_rate']; - $sql .= "', boil_time='" . $_GET['boil_time']; - ($_GET['calc_boil_volume'] == 'true') ? $sql .= "', calc_boil_volume='1" : $sql .= "', calc_boil_volume='0"; - $sql .= "', top_up_kettle='" . $_GET['top_up_kettle']; - $sql .= "', hop_utilization='" . $_GET['hop_utilization']; - $sql .= "', notes='" . mysqli_real_escape_string($connect, $_GET['notes']); - $sql .= "', lauter_volume='" . $_GET['lauter_volume']; - $sql .= "', lauter_height='" . $_GET['lauter_height'] / 100.0; - $sql .= "', lauter_deadspace='" . $_GET['lauter_deadspace']; - $sql .= "', kettle_volume='" . $_GET['kettle_volume']; - $sql .= "', kettle_height='" . $_GET['kettle_height'] / 100.0; - $sql .= "', mash_volume='" . $_GET['mash_volume']; - $sql .= "', mash_max='" . $_GET['mash_max']; - $sql .= "', efficiency='" . $_GET['efficiency']; - if (isset($_GET['insert'])) { + $sql .= "name='" . mysqli_real_escape_string($connect, $_POST['name']); + $sql .= "', boil_size='" . $_POST['boil_size']; + $sql .= "', batch_size='" . $_POST['batch_size']; + $sql .= "', tun_volume='" . $_POST['tun_volume']; + $sql .= "', tun_weight='" . $_POST['tun_weight']; + $sql .= "', tun_specific_heat='" . $_POST['tun_specific_heat']; + $sql .= "', tun_material='" . $_POST['tun_material']; + $sql .= "', tun_height='" . floatval($_POST['tun_height']) / 100.0; + $sql .= "', top_up_water='" . $_POST['top_up_water']; + $sql .= "', trub_chiller_loss='" . $_POST['trub_chiller_loss']; + $sql .= "', evap_rate='" . $_POST['evap_rate']; + $sql .= "', boil_time='" . $_POST['boil_time']; + ($_POST['calc_boil_volume'] == 'true') ? $sql .= "', calc_boil_volume='1" : $sql .= "', calc_boil_volume='0"; + $sql .= "', top_up_kettle='" . $_POST['top_up_kettle']; + $sql .= "', hop_utilization='" . $_POST['hop_utilization']; + $sql .= "', notes='" . mysqli_real_escape_string($connect, $_POST['notes']); + $sql .= "', lauter_volume='" . $_POST['lauter_volume']; + $sql .= "', lauter_height='" . floatval($_POST['lauter_height']) / 100.0; + $sql .= "', lauter_deadspace='" . $_POST['lauter_deadspace']; + $sql .= "', kettle_volume='" . $_POST['kettle_volume']; + $sql .= "', kettle_height='" . floatval($_POST['kettle_height']) / 100.0; + $sql .= "', mash_volume='" . $_POST['mash_volume']; + $sql .= "', mash_max='" . $_POST['mash_max']; + $sql .= "', efficiency='" . $_POST['efficiency']; + if (isset($_POST['insert'])) { $sql .= "';"; } - if (isset($_GET['update'])) { - $sql .= "' WHERE record='" . $_GET['record'] . "';"; + if (isset($_POST['update'])) { + $sql .= "' WHERE record='" . $_POST['record'] . "';"; } $result = mysqli_query($connect, $sql); if (! $result) { syslog(LOG_NOTICE, "db_inventory_equipment: ".$sql." result: ".mysqli_error($connect)); } else { - if (isset($_GET['update'])) { - syslog(LOG_NOTICE, "db_inventory_equipment: updated record ".$_GET['record']); + if (isset($_POST['update'])) { + syslog(LOG_NOTICE, "db_inventory_equipment: updated record ".$_POST['record']); } else { $lastid = mysqli_insert_id($connect); syslog(LOG_NOTICE, "db_inventory_equipment: inserted record ".$lastid); @@ -63,20 +61,21 @@ } echo $result; -} else if (isset($_GET['delete'])) { +} else if (isset($_POST['delete'])) { // DELETE COMMAND // FIXME: need to check if the record is in use - $sql = "DELETE FROM `inventory_equipments` WHERE record='".$_GET['record']."';"; + $sql = "DELETE FROM `inventory_equipments` WHERE record='".$_POST['record']."';"; $result = mysqli_query($connect, $sql); if (! $result) { syslog(LOG_NOTICE, "db_inventory_equipment: ".$sql." result: ".mysqli_error($connect)); } else { - syslog(LOG_NOTICE, "db_inventory_equipment: deleted record ".$_GET['record']); + syslog(LOG_NOTICE, "db_inventory_equipment: deleted record ".$_POST['record']); } echo $result; } else { // SELECT COMMAND + $query = "SELECT * FROM inventory_equipments ORDER BY name"; $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $equipments[] = array( @@ -88,7 +87,7 @@ 'tun_weight' => $row['tun_weight'], 'tun_specific_heat' => $row['tun_specific_heat'], 'tun_material' => $row['tun_material'], - 'tun_height' => $row['tun_height'] * 100.0, + 'tun_height' => floatval($row['tun_height']) * 100.0, 'top_up_water' => $row['top_up_water'], 'trub_chiller_loss' => $row['trub_chiller_loss'], 'evap_rate' => $row['evap_rate'], @@ -98,10 +97,10 @@ 'hop_utilization' => $row['hop_utilization'], 'notes' => $row['notes'], 'lauter_volume' => $row['lauter_volume'], - 'lauter_height' => $row['lauter_height'] * 100.0, + 'lauter_height' => floatval($row['lauter_height']) * 100.0, 'lauter_deadspace' => $row['lauter_deadspace'], 'kettle_volume' => $row['kettle_volume'], - 'kettle_height' => $row['kettle_height'] * 100.0, + 'kettle_height' => floatval($row['kettle_height']) * 100.0, 'mash_volume' => $row['mash_volume'], 'mash_max' => $row['mash_max'], 'efficiency' => $row['efficiency']
--- a/www/inv_equipments.php Sat Jan 26 11:59:15 2019 +0100 +++ b/www/inv_equipments.php Sat Jan 26 15:03:09 2019 +0100 @@ -13,7 +13,7 @@ <div id="popupWindow"> <div>Wijzig brouw apparatuur.</div> <div style="overflow: hidden;"> - <table> + <table style="width: 100%;"> <tr> <td style="vertical-align: top; float: right;">Installatie naam:</td> <td style="vertical-align: top;"><input id="name" /></td> @@ -98,10 +98,13 @@ <td colspan="2"></td> </tr> <tr> - <td style="padding-top: 10px; float: right;"><input type="button" id="Delete" value="Delete" /></td> + <td style="padding-top: 10px; float: right;"><input type="button" id="Delete" value="Verwijder" /></td> <td></td> <td></td> - <td style="padding-top: 10px;"><input style="margin-right: 5px;" type="button" id="Save" value="Save" /><input id="Cancel" type="button" value="Cancel" /></td> + <td style="padding-top: 10px;"> + <input style="margin-right: 5px;" type="button" id="Save" value="Sla op" /> + <input id="Cancel" type="button" value="Annuleer" /> + </td> </tr> </table> </div>
--- a/www/inv_instock.php Sat Jan 26 11:59:15 2019 +0100 +++ b/www/inv_instock.php Sat Jan 26 15:03:09 2019 +0100 @@ -66,8 +66,9 @@ } function TableFermentables($link,$prop) { - $this->AddCol( 30,'Leverancier','L'); - $this->AddCol( 90,'Vergistbaar ingredient','L'); + $this->AddCol( 26,'Type','L'); + $this->AddCol( 26,'Leverancier','L'); + $this->AddCol( 68,'Vergistbaar ingredient','L'); $this->AddCol( 30,'Voorraad','R'); $this->AddCol( 20, 'Prijs/kg', 'R'); $this->AddCol( 20, 'Waarde', 'R'); @@ -84,7 +85,9 @@ $this->ColorIndex=0; $this->ProcessingTable=true; - $result = mysqli_query($link, "SELECT name,supplier,inventory,cost FROM inventory_fermentables WHERE inventory > 0 ORDER BY supplier,name"); + $type = array( 'Mout', 'Suiker', 'V Extract', 'Extract', 'Ongemout graan' ); + $sql = "SELECT type,name,supplier,inventory,cost FROM inventory_fermentables WHERE inventory > 0 ORDER BY type,supplier,name"; + $result = mysqli_query($link, $sql); $tot_fermentables = 0.0; while($row=mysqli_fetch_array($result)) { @@ -94,8 +97,9 @@ $this->SetX($this->TableX); $ci=$this->ColorIndex; $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); - $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['supplier']),0,0,'L',true); - $this->Cell(90,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); + $this->Cell(26,5,$type[$row['type']],0,0,'L',true); + $this->Cell(26,5,iconv('UTF-8','windows-1252',$row['supplier']),0,0,'L',true); + $this->Cell(68,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); $this->Cell(30,5,sprintf("%10.3f kg",$row['inventory']),0,0,'R',true); $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); @@ -131,6 +135,7 @@ $this->ColorIndex=0; $this->ProcessingTable=true; + $type = array( 'Pellets', 'Plugs', 'Bellen' ); $result = mysqli_query($link, "SELECT name,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 0 ORDER BY origin,name"); $tot_hops = 0.0; @@ -144,7 +149,7 @@ $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['origin']),0,0,'L',true); $this->Cell(75,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); - $this->Cell(15,5,iconv('UTF-8','windows-1252',$row['form']),0,0,'L',true); + $this->Cell(15,5,$type[$row['form']],0,0,'L',true); $this->Cell(30,5,sprintf("%10.1f gr",$stock),0,0,'R',true); $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); @@ -180,14 +185,18 @@ $this->ColorIndex=0; $this->ProcessingTable=true; - $result = mysqli_query($link, "SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0 ORDER BY laboratory,product_id"); + $sql = "SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0 ORDER BY laboratory,product_id"; + $result = mysqli_query($link, $sql); $tot_yeasts = 0.0; while($row=mysqli_fetch_array($result)) { $value = $row['inventory'] * $row['cost']; $tot_yeasts += $value; - $stock = floatval($row['inventory']) * 1000.0; - ($row['form'] == 'Dry') ? $amount = "gr" : $amount = "ml"; + if ($row['form'] == 0) + $stock = floatval($row['inventory']); + else + $stock = floatval($row['inventory']) * 1000.0; + $form = array( 'pak', 'gr', 'ml', 'ml', 'ml', 'ml' ); $this->SetX($this->TableX); $ci=$this->ColorIndex; @@ -195,7 +204,7 @@ $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['laboratory']),0,0,'L',true); $this->Cell(20,5,iconv('UTF-8','windows-1252',$row['product_id']),0,0,'L',true); $this->Cell(70,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); - $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); + $this->Cell(30,5,sprintf("%10.1f ",$stock).$form[$row['form']],0,0,'R',true); $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); $this->Ln(); @@ -231,6 +240,7 @@ $result = mysqli_query($link, "SELECT name,type,amount_is_weight,inventory,cost FROM inventory_miscs WHERE inventory > 0 ORDER BY type,name"); $tot_miscs = 0.0; + $type = array( 'Specerij', 'Kruid', 'Smaakstof', 'Klaringsmiddel', 'Brouwzout', 'Gistvoeding', 'Anders' ); while($row=mysqli_fetch_array($result)) { $value = $row['inventory'] * $row['cost']; @@ -241,7 +251,7 @@ $this->SetX($this->TableX); $ci=$this->ColorIndex; $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); - $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['type']),0,0,'L',true); + $this->Cell(30,5,$type[$row['type']],0,0,'L',true); $this->Cell(90,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true);
--- a/www/js/global.js Sat Jan 26 11:59:15 2019 +0100 +++ b/www/js/global.js Sat Jan 26 15:03:09 2019 +0100 @@ -346,118 +346,41 @@ // options for editors var Spin1dec1 = { - inputMode: 'simple', - spinMode: 'simple', - theme: theme, - width: 110, - height: 23, - min: 0, - decimalDigits: 1, - spinButtons: true, - spinButtonsStep: 0.1 + inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }; var Spin1dec5 = { - inputMode: 'simple', - spinMode: 'simple', - theme: theme, - width: 110, - height: 23, - min: 0, - decimalDigits: 1, - spinButtons: true, - spinButtonsStep: 0.5 + inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 +}; +var Spin2dec1 = { + inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.01 +}; +var Spin2dec5 = { + inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.05 }; var SpinpH = { - inputMode: 'simple', - spinMode: 'simple', - theme: theme, - width: 110, - height: 23, - min: 1, - max: 14, - decimalDigits: 1, - spinButtons: true, - spinButtonsStep: 0.1 + inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 1, max: 14, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }; var Spin2pH = { - inputMode: 'simple', - spinMode: 'simple', - theme: theme, - width: 110, - height: 23, - min: 1, - max: 14, - decimalDigits: 2, - spinButtons: true, - spinButtonsStep: 0.05 + inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 1, max: 14, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.05 }; var YeastT = { - inputMode: 'simple', - spinMode: 'simple', - theme: theme, - width: 110, - height: 23, - min: 0, - max: 40, - decimalDigits: 1, - spinButtons: true, - spinButtonsStep: 0.5 + inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 40, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }; var PosInt = { - inputMode: 'simple', - spinMode: 'simple', - theme: theme, - width: 110, - height: 23, - min: 0, - decimalDigits: 0, - spinButtons: true, + inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 0, spinButtons: true, }; var Perc1dec5 = { - inputMode: 'simple', - spinMode: 'simple', - theme: theme, - width: 110, - height: 23, - min: 0, - max: 100, - decimalDigits: 1, - spinButtons: true, - spinButtonsStep: 0.5 + inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 100, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }; var Perc1dec1 = { - inputMode: 'simple', - spinMode: 'simple', - theme: theme, - width: 110, - height: 23, - min: 0, - max: 100, - decimalDigits: 1, - spinButtons: true, - spinButtonsStep: 0.1 + inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 100, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }; -var Spin2dec1 = { - inputMode: 'simple', - spinMode: 'simple', - theme: theme, - width: 110, - height: 23, - min: 0, - decimalDigits: 2, - spinButtons: true, - spinButtonsStep: 0.01 +var Perc0 = { + inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 100, decimalDigits: 0, spinButtons: true }; var Dateopts = { - theme: theme, - width: 150, - height: 23, - allowNullDate: true, - todayString: 'Vandaag', - clearString: 'Wissen', - showFooter: true, - formatString: 'yyyy-MM-dd', - enableBrowserBoundsDetection: true + theme: theme, width: 150, height: 23, allowNullDate: true, todayString: 'Vandaag', clearString: 'Wissen', showFooter: true, + formatString: 'yyyy-MM-dd', enableBrowserBoundsDetection: true };
--- a/www/js/inv_equipments.js Sat Jan 26 11:59:15 2019 +0100 +++ b/www/js/inv_equipments.js Sat Jan 26 15:03:09 2019 +0100 @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2014-2018 + * Copyright (C) 2014-2019 * * Michiel Broek <mbroek at mbse dot eu> * @@ -44,6 +44,8 @@ $(document).ready(function () { + var dataRecord = {}; + function calcBatchVolume() { var calc = $("#calc_boil_volume").val(); var boil_size = parseFloat($("#boil_size").jqxNumberInput('decimal')); @@ -93,13 +95,13 @@ { name: 'tun_volume', type: 'float' }, { name: 'tun_weight', type: 'float' }, { name: 'tun_specific_heat', type: 'float' }, - { name: 'tun_material', type: 'string' }, + { name: 'tun_material', type: 'int' }, { 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: 'calc_boil_volume', type: 'bool' }, + { name: 'calc_boil_volume', type: 'int' }, { name: 'top_up_kettle', type: 'float' }, { name: 'hop_utilization', type: 'float' }, { name: 'notes', type: 'string' }, @@ -122,6 +124,7 @@ url: url, cache: false, data: data, + type: "POST", success: function (data, status, xhr) { // delete command is executed. commit(true); @@ -138,6 +141,7 @@ url: url, cache: false, data: data, + type: "POST", success: function (data, status, xhr) { commit(true); }, @@ -153,6 +157,7 @@ url: url, cache: false, data: data, + type: "POST", success: function (data, status, xhr) { // update command is executed. commit(true); @@ -165,20 +170,30 @@ }; // initialize the input fields. - var srcMaterial= [ "RVS", "Aluminium", "Kunststof", "Koper" ]; - $("#name").jqxInput({ theme: theme, width: 250, height: 23 }); - $("#boil_size").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 200000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); - $("#batch_size").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 200000, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.5 }); - $("#tun_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 200000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); - $("#tun_weight").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 2, spinButtons: true }); + $("#notes").jqxInput({ theme: theme, width: 640, height: 100 }); + $("#boil_size").jqxNumberInput( Spin1dec5 ); + $("#batch_size").jqxNumberInput( Spin2dec1 ); + $("#batch_size").jqxNumberInput({ spinButtonsStep: 0.5 }); + $("#tun_volume").jqxNumberInput( Spin1dec5 ); + $("#tun_weight").jqxNumberInput( Spin2dec1 ); $("#tun_specific_heat").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, 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: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); - $("#top_up_water").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 20000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); - $("#trub_chiller_loss").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); - $("#evap_rate").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 40000, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.05 }); - $("#boil_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 1440, decimalDigits: 0, spinButtons: true }); + $("#tun_material").jqxDropDownList({ + theme: theme, + source: MaterialAdapter, + valueMember: 'id', + displayMember: 'nl', +// selectedIndex: 0, + width: 180, + height: 23, + autoDropDownHeight: true + }); + $("#tun_height").jqxNumberInput( Spin1dec1 ); + $("#top_up_water").jqxNumberInput( Spin1dec1 ); + $("#trub_chiller_loss").jqxNumberInput( Spin1dec1 ); + $("#evap_rate").jqxNumberInput( Spin2dec1 ); + $("#boil_time").jqxNumberInput( PosInt ); + $("#boil_time").jqxNumberInput({ max: 1440 }); $("#calc_boil_volume").jqxCheckBox({ theme: theme, width: 120, height: 23 }); $("#calc_boil_volume").on('checked', function (event) { $("#batch_size").jqxNumberInput({ readOnly: true, width: 90, spinButtons: false }); @@ -186,17 +201,18 @@ $("#calc_boil_volume").on('unchecked', function (event) { $("#batch_size").jqxNumberInput({ readOnly: false, width: 110, spinButtons: true }); }); - $("#top_up_kettle").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, 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: 110, height: 23, min: 0, max: 200000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); - $("#lauter_height").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); - $("#lauter_deadspace").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); - $("#kettle_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 200000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); - $("#kettle_height").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); - $("#mash_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 200000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); - $("#mash_max").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 200000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); - $("#efficiency").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); + $("#top_up_kettle").jqxNumberInput( Spin1dec1 ); + $("#hop_utilization").jqxNumberInput( Perc0 ); + $("#hop_utilization").jqxNumberInput({ Max: 200 }); + $("#lauter_volume").jqxNumberInput( Spin1dec5 ); + $("#lauter_height").jqxNumberInput( Spin1dec1 ); + $("#lauter_deadspace").jqxNumberInput( Spin1dec1 ); + $("#kettle_volume").jqxNumberInput( Spin1dec5 ); + $("#kettle_height").jqxNumberInput( Spin1dec1 ); + $("#mash_volume").jqxNumberInput( Spin1dec5 ); + $("#mash_max").jqxNumberInput( Spin1dec5 ); + $("#efficiency").jqxNumberInput( Perc1dec5 ); + var dataAdapter = new $.jqx.dataAdapter(source); var editrow = -1; // initialize jqxGrid @@ -212,40 +228,39 @@ var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>"); container.append(addButton); statusbar.append(container); - addButton.jqxButton({ theme: theme, width: 120, height: 20 }); + addButton.jqxButton({ theme: theme, width: 90, height: 20 }); // add new row. addButton.click(function (event) { editrow = -1; - $("#popupWindow").jqxWindow({ position: { x: 180, y: 30 } }); - $("#name").val(''); - $("#boil_size").val('18'); - $("#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'); - $("#calc_boil_volume").val(true); - $("#top_up_kettle").val('0'); - $("#hop_utilization").val('100'); + $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } }); + $("#name").val('Nieuwe brouwset'); + $("#boil_size").val(18); + $("#batch_size").val(15.3); + $("#tun_volume").val(20); + $("#tun_weight").val(2); + $("#tun_specific_heat").val(0.11); + $("#tun_material").val(0); + $("#tun_height").val(20); + $("#top_up_water").val(0); + $("#trub_chiller_loss").val(0.5); + $("#evap_rate").val(1.8); + $("#boil_time").val(90); + $("#calc_boil_volume").val(1); + $("#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'); - $("#kettle_height").val('20'); - $("#mash_volume").val('18'); - $("#mash_max").val('6'); - $("#efficiency").val('75'); + $("#lauter_volume").val(20); + $("#lauter_height").val(20); + $("#lauter_deadspace").val(0.5); + $("#kettle_volume").val(20); + $("#kettle_height").val(20); + $("#mash_volume").val(18); + $("#mash_max").val(6); + $("#efficiency").val(75); $("#popupWindow").jqxWindow('open'); }); }, - filterable: true, - filtermode: 'excel', + filterable: false, ready: function() { $('#boil_size').on('change', function (event) { calcBatchVolume(); }); $('#evap_rate').on('change', function (event) { calcBatchVolume(); }); @@ -253,31 +268,23 @@ $('#top_up_kettle').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; - } + dataRecord.tun_specific_heat = MaterialData[event.args.index].sh; + $("#tun_specific_heat").val(dataRecord.tun_specific_heat); }); }, columns: [ { text: 'Installatie naam', datafield: 'name', width: 200 }, - { text: 'Kook volume', datafield: 'boil_size', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: 'Batch volume', datafield: 'batch_size', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, + { text: 'Kook volume', datafield: 'boil_size', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, + { text: 'Batch volume', datafield: 'batch_size', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, { text: 'Opmerkingen', datafield: 'notes' }, - { text: 'Wijzig', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () { + { text: 'Wijzig', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function () { return "Wijzig"; }, buttonclick: function (row) { // open the popup window when the user clicks a button. editrow = row; - $("#popupWindow").jqxWindow({ position: { x: 180, y: 30 } }); + $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } }); // get the clicked row's data and initialize the input fields. - var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); + dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); $("#name").val(dataRecord.name); $("#boil_size").val(dataRecord.boil_size); $("#batch_size").val(dataRecord.batch_size); @@ -310,12 +317,19 @@ }); // initialize the popup window and buttons. $("#popupWindow").jqxWindow({ - width: 900, resizable: false, theme: theme, isModal: true, autoOpen: false, cancelButton: $("#Cancel"), modalOpacity: 0.40 + width: 1050, + height: 600, + resizable: false, + theme: theme, + isModal: true, + autoOpen: false, + cancelButton: $("#Cancel"), + modalOpacity: 0.40 }); $("#popupWindow").on('open', function () { $("#name").jqxInput('selectAll'); }); - $("#Delete").jqxButton({ template: "danger", width: '80px', theme: theme }); + $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme }); $("#Delete").click(function () { if (editrow >= 0) { // Open a popup to confirm this action. @@ -327,7 +341,7 @@ } $("#popupWindow").jqxWindow('hide'); }); - $("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme }); + $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); // update the edited row when the user clicks the 'Save' button. $("#Save").click(function () { @@ -368,6 +382,7 @@ $('#jqxgrid').jqxGrid('addrow', null, row); } $("#popupWindow").jqxWindow('hide'); + location.reload( true ); // reload ourself. }); createDelElements(); });