Mon, 13 Aug 2018 15:11:26 +0200
Added hops inventory
--- a/www/import/from_brouwhulp.php Sun Aug 12 23:20:17 2018 +0200 +++ b/www/import/from_brouwhulp.php Mon Aug 13 15:11:26 2018 +0200 @@ -121,6 +121,8 @@ $sql .= "', inventory='" . $hop->INVENTORY; if ($hop->COST) $sql .= "', cost='" . $hop->COST; + if ($hop->TOTAL_OIL) + $sql .= "', total_oil='" . $hop->TOTAL_OIL; $sql .= "';"; if (! $result = mysqli_query($db, $sql)) { printf("Error: %s\n", mysqli_error($db)); @@ -445,7 +447,7 @@ do_fermentables(); -//do_hops(); +do_hops(); //do_yeasts(); //do_waters(); //do_miscs();
--- a/www/includes/db_inventory_hops.php Sun Aug 12 23:20:17 2018 +0200 +++ b/www/includes/db_inventory_hops.php Mon Aug 13 15:11:26 2018 +0200 @@ -20,6 +20,7 @@ $sql .= "', caryophyllene='" . $_GET['caryophyllene']; $sql .= "', cohumulone='" . $_GET['cohumulone']; $sql .= "', myrcene='" . $_GET['myrcene']; + $sql .= "', hsi='" . $_GET['hsi']; $sql .= "', useat='" . $_GET['useat']; $sql .= "', type='" . $_GET['type']; $sql .= "', form='" . $_GET['form']; @@ -32,6 +33,7 @@ $sql .= "', production_date='" . $_GET['production_date']; $sql .= "', tht_date='" . $_GET['tht_date']; $sql .= "', supplier_rec='" . $_GET['supplier_rec']; + $sql .= "', total_oil'" . $_GET['total_oil']; $sql .= "';"; error_log("\"$sql\""); $result = mysqli_query($connect, $sql) or die("SQL Error 1: " . mysqli_error($connect)); @@ -47,6 +49,7 @@ $sql .= "', caryophyllene='" . $_GET['caryophyllene']; $sql .= "', cohumulone='" . $_GET['cohumulone']; $sql .= "', myrcene='" . $_GET['myrcene']; + $sql .= "', hsi='" . $_GET['hsi']; $sql .= "', useat='" . $_GET['useat']; $sql .= "', type='" . $_GET['type']; $sql .= "', form='" . $_GET['form']; @@ -59,6 +62,7 @@ $sql .= "', production_date='" . $_GET['production_date']; $sql .= "', tht_date='" . $_GET['tht_date']; $sql .= "', supplier_rec='" . $_GET['supplier_rec']; + $sql .= "', total_oil'" . $_GET['total_oil']; $sql .= "' WHERE record='" . $_GET['record'] . "';"; error_log("\"$sql\""); $result = mysqli_query($connect, $sql) or die("SQL Error 1: " . mysqli_error($connect)); @@ -86,6 +90,7 @@ 'caryophyllene' => $row['caryophyllene'], 'cohumulone' => $row['cohumulone'], 'myrcene' => $row['myrcene'], + 'hsi' => $row['hsi'], 'useat' => $row['useat'], 'type' => $row['type'], 'form' => $row['form'], @@ -97,7 +102,8 @@ 'cost' => $row['cost'], 'production_date' => $row['production_date'], 'tht_date' => $row['tht_date'], - 'supplier_rec' => $row['supplier_rec'] + 'supplier_rec' => $row['supplier_rec'], + 'total_oil' => $row['total_oil'] ); } echo json_encode($hops);
--- a/www/inv_hops.php Sun Aug 12 23:20:17 2018 +0200 +++ b/www/inv_hops.php Mon Aug 13 15:11:26 2018 +0200 @@ -19,45 +19,49 @@ <td align="left" colspan="3" style="vertical-align: top;"><input id="name" /></td> </tr> <tr> - <td align="right" style="vertical-align: top;">Alpha:</td> + <td align="right" style="vertical-align: top;">Alphazuur %:</td> <td align="left" style="vertical-align: top;"><input id="alpha" /></td> - <td align="right" style="vertical-align: top;">Beta:</td> + <td align="right" style="vertical-align: top;">Betazuur %:</td> <td align="left" style="vertical-align: top;"><input id="beta" /></td> </tr> <tr> - <td align="right" style="vertical-align: top;">Humulene:</td> + <td align="right" style="vertical-align: top;">Humuleen %:</td> <td align="left" style="vertical-align: top;"><input id="humulene" /></td> - <td align="right" style="vertical-align: top;">Caryophyllene:</td> + <td align="right" style="vertical-align: top;">Caryophylleen %:</td> <td align="left" style="vertical-align: top;"><input id="caryophyllene" /></td> </tr> <tr> - <td align="right" style="vertical-align: top;">cohumulone:</td> - <td align="left" colspan="3" style="vertical-align: top;"><input id="cohumulone" /></td> + <td align="right" style="vertical-align: top;">Cohumuloon %:</td> + <td align="left" style="vertical-align: top;"><input id="cohumulone" /></td> + <td align="right" style="vertical-align: top;">Totaal oliegehalte %:</td> + <td align="left" colspan="3" style="vertical-align: top;"><input id="total_oil" /></td> </tr> <tr> - <td align="right" style="vertical-align: top;">myrcene:</td> + <td align="right" style="vertical-align: top;">Myrceen %:</td> <td align="left" style="vertical-align: top;"><input id="myrcene" /></td> - <td align="right" style="vertical-align: top;">useat:</td> - <td align="left" style="vertical-align: top;"><input id="useat" /></td> + <td align="right" style="vertical-align: top;">Hop stabiliteitindex:</td> + <td align="left" style="vertical-align: top;"><input id="hsi" /></td> </tr> <tr> - <td align="right" style="vertical-align: top;">type:</td> - <td align="left" style="vertical-align: top;"><input id="type" /></td> - <td align="right" style="vertical-align: top;">form:</td> - <td align="left" style="vertical-align: top;"><input id="form" /></td> + <td align="right" style="vertical-align: top;">Soort:</td> + <td align="left"><div id="type"></div></td> + <td align="right" style="vertical-align: top;">Vorm:</td> + <td align="left"><div id="form"></div></td> </tr> <tr> - <td align="right" style="vertical-align: top;">origin:</td> + <td align="right" style="vertical-align: top;">Herkomst:</td> <td align="left" style="vertical-align: top;"><input id="origin" /></td> - <td align="right" style="vertical-align: top;">substitutes:</td> + <td align="right" style="vertical-align: top;">Vervangen door:</td> <td align="left" style="vertical-align: top;"><input id="substitutes" /></td> </tr> - <tr> +<!-- <tr> <td align="right" style="vertical-align: top;">supplier_rec:</td> - <td align="left" colspan="3"><div id="supplier_rec"></div></td> - </tr> + <td align="left"><div id="supplier_rec"></div></td> + <td align="right" style="vertical-align: top;">useat:</td> + <td align="left"><div id="useat"></div></td> + </tr> --> <tr> - <td align="right" style="vertical-align: top;">always_on_stock:</td> + <td align="right" style="vertical-align: top;">Altijd op voorraad::</td> <td align="left" colspan="3"><div id="always_on_stock"></div></td> </tr> <tr> @@ -65,13 +69,13 @@ <td align="left" colspan="3"><textarea id="notes"></textarea></td> </tr> <tr> - <td align="right" style="vertical-align: top;">Voorraad:</td> + <td align="right" style="vertical-align: top;">Voorraad in gram:</td> <td align="left"><div id="inventory"></div></td> - <td align="right" style="vertical-align: top;">Prijs:</td> + <td align="right" style="vertical-align: top;">Prijs per kg.:</td> <td align="left"><div id="cost"></div></td> </tr> <tr> - <td align="right" style="vertical-align: top;">Productie datum:</td> + <td align="right" style="vertical-align: top;">Oogst datum:</td> <td align="left" style="vertical-align: top;"><div id="production_date"></div></td> <td align="right" style="vertical-align: top;">Gebruik voor datum:</td> <td align="left" style="vertical-align: top;"><div id="tht_date"></div></td>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www/js/global.js Mon Aug 13 15:11:26 2018 +0200 @@ -0,0 +1,96 @@ +/***************************************************************************** + * Copyright (C) 2014 + * + * Michiel Broek <mbroek at mbse dot eu> + * + * This file is part of BrewCloud + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * BrewCloud is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ThermFerm; see the file COPYING. If not, write to the Free + * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + *****************************************************************************/ + +function createElements() { + $('#aboutWindow').jqxWindow({ + resizable: true, + minWidth: 300, + minHeight: 300, + theme: theme, + autoOpen: false, + isModal: true + }); + $('#aboutWindow').jqxWindow('focus'); +} + + + +function getLocalization() { + var localizationobj = {}; + localizationobj.pagerGoToPageString = "Gehe zu:"; + localizationobj.pagerShowRowsString = "Zeige Zeile:"; + localizationobj.pagerRangeString = " von "; + localizationobj.pagerNextButtonString = "voriger"; + localizationobj.pagerFirstButtonString = "first"; + localizationobj.pagerLastButtonString = "last"; + localizationobj.pagerPreviousButtonString = "nächster"; + localizationobj.sortAscendingString = "Sortiere aufsteigend"; + localizationobj.sortDescendingString = "Sortiere absteigend"; + localizationobj.sortRemoveString = "Entferne Sortierung"; + localizationobj.firstDay = 1; + localizationobj.percentSymbol = "%"; + localizationobj.currencySymbol = "€"; + localizationobj.currencySymbolPosition = "after"; + localizationobj.decimalSeparator = ","; + localizationobj.thousandsSeparator = "."; + var days = { + // full day names + names: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], + // abbreviated day names + namesAbbr: ["Sonn", "Mon", "Dien", "Mitt", "Donn", "Fre", "Sams"], + // shortest day names + namesShort: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"] + }; + localizationobj.days = days; + var months = { + // full month names (13 months for lunar calendards -- 13th month should be "" if not lunar) + names: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", ""], + // abbreviated month names + namesAbbr: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dez", ""] + }; + var patterns = { + d: "dd.MM.yyyy", + D: "dddd, d. MMMM yyyy", + t: "HH:mm", + T: "HH:mm:ss", + f: "dddd, d. MMMM yyyy HH:mm", + F: "dddd, d. MMMM yyyy HH:mm:ss", + M: "dd MMMM", + Y: "MMMM yyyy" + } + localizationobj.patterns = patterns; + localizationobj.months = months; + return localizationobj; +} + + + +$(document).ready(function () { + $("#jqxMenu").jqxMenu({ + width: 1280, + height: '30px', + theme: theme + }); + createElements(); + $("#jqxWidget").css('visibility', 'visible'); +}); +
--- a/www/js/inv_hops.js Sun Aug 12 23:20:17 2018 +0200 +++ b/www/js/inv_hops.js Mon Aug 13 15:11:26 2018 +0200 @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2014=2018 + * Copyright (C) 2014-2018 * * Michiel Broek <mbroek at mbse dot eu> * @@ -57,6 +57,7 @@ { name: 'caryophyllene', type: 'float' }, { name: 'cohumulone', type: 'float' }, { name: 'myrcene', type: 'float' }, + { name: 'hsi', type: 'float' }, { name: 'useat', type: 'string' }, { name: 'type', type: 'string' }, { name: 'form', type: 'string' }, @@ -68,7 +69,8 @@ { name: 'cost', type: 'float' }, { name: 'production_date', type: 'string' }, { name: 'tht_date', type: 'string' }, - { name: 'supplier_rec', type: 'float' } + { name: 'supplier_rec', type: 'number' }, + { name: 'total_oil', type: 'float' } ], id: 'record', url: url, @@ -121,7 +123,7 @@ }); } }; - var srcUse = [ "Boil", "Dry Hop", "Mash", "First Wort", "Aroma" ]; +// var srcUse = [ "Boil", "Dry Hop", "Mash", "First Wort", "Aroma" ]; // Only in recipes var srcType = [ "Bittering", "Aroma", "Both" ]; var srcForm = [ "Pellet", "Plug", "Leaf" ]; // initialize the input fields. @@ -132,11 +134,12 @@ $("#caryophyllene").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); $("#cohumulone").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); $("#myrcene").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); + $("#hsi").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); - $("#useat").jqxDropDownList({ theme: theme, source: srcType, width: 90, height: 23, dropDownHeight: 130 }); - $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 90, height: 23, dropDownHeight: 130 }); - $("#form").jqxDropDownList({ theme: theme, source: srcType, width: 90, height: 23, dropDownHeight: 130 }); - $("#notes").jqxInput({ theme: theme, width: 640, height: 48 }); +// $("#useat").jqxDropDownList({ theme: theme, source: srcUse, width: 90, height: 23, dropDownHeight: 130 }); // Only in recipes + $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 90, height: 23, dropDownHeight: 95 }); + $("#form").jqxDropDownList({ theme: theme, source: srcForm, width: 90, height: 23, dropDownHeight: 95 }); + $("#notes").jqxInput({ theme: theme, width: 640, height: 100 }); $("#origin").jqxInput({ theme: theme, width: 250, height: 23 }); $("#substitutes").jqxInput({ theme: theme, width: 250, height: 23 }); $("#always_on_stock").jqxCheckBox({ theme: theme, width: 120, height: 23 }); @@ -144,7 +147,8 @@ $("#production_date").jqxDateTimeInput({ theme: theme, width: 100, height: 23, formatString: 'yyyy-MM-dd' }); $("#cost").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 2, spinButtons: true }); $("#tht_date").jqxDateTimeInput({ theme: theme, width: 100, height: 23, formatString: 'yyyy-MM-dd' }); - $("#supplier_rec").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); +// $("#supplier_rec").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); // Implement later. + $("#total_oil").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); var dataAdapter = new $.jqx.dataAdapter(source); var editrow = -1; // initialize jqxGrid @@ -153,7 +157,9 @@ height: 630, source: dataAdapter, theme: theme, + //altrows: true, showstatusbar: true, + localization: getLocalization(), renderstatusbar: function (statusbar) { var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 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;'>Add</span></div>"); @@ -163,7 +169,7 @@ // add new row. addButton.click(function (event) { editrow = -1; - $("#popupWindow").jqxWindow({ position: { x: 80, y: 10 } }); + $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); $("#name").val(''); $("#alpha").val(''); $("#beta").val(''); @@ -171,6 +177,7 @@ $("#caryophyllene").val(''); $("#cohumulone").val(''); $("#myrcene").val(''); + $("#hsi").val(''); $("#useat").val('Boil'); $("#type").val('Bittering'); $("#form").val('Pellet'); @@ -183,24 +190,30 @@ $("#production_date").val(''); $("#tht_date").val(''); $("#supplier_rec").val(''); + $("#total_oil").val(''); $("#popupWindow").jqxWindow('open'); }); }, filterable: true, filtermode: 'excel', columns: [ - { text: 'Hop Name', datafield: 'name', width: 250 }, - { text: 'Type', datafield: 'type', width: 90 }, - { text: 'Alpha', datafield: 'alpha', width: 70, cellsalign: 'right', cellsformat: 'c2' }, - { text: 'Origin', datafield: 'origin', width: 150 }, - { text: 'Inv.', datafield: 'inventory', width: 70, cellsalign: 'right' }, - { text: 'Cost', datafield: 'cost', width: 70, cellsalign: 'right', cellsformat: 'c2' }, + { text: 'Hop Naam', datafield: 'name', width: 250 }, + { text: 'Soort', datafield: 'type', width: 90 }, + { text: 'Vorm', datafield: 'form', width: 90 }, + { text: 'Alpha %', datafield: 'alpha', width: 80, cellsalign: 'right', cellsformat: 'p1' }, + { text: 'Beta %', datafield: 'beta', width: 80, cellsalign: 'right', cellsformat: 'p1' }, + { text: 'Cohumuloon %%', datafield: 'cohumulone', width: 80, cellsalign: 'right', cellsformat: 'p1' }, + { text: 'HSI', datafield: 'hsi', width: 60, cellsalign: 'right', cellsformat: 'f1' }, + { text: 'Herkomst', datafield: 'origin', width: 150 }, + { text: 'Oogst datum', datafield: 'production_date', width: 100 }, + { text: 'Voorraad', datafield: 'inventory', width: 70, cellsalign: 'right' }, + { text: 'Prijs /kg', datafield: 'cost', width: 70, cellsalign: 'right', cellsformat: 'c2' }, { text: 'Edit', datafield: 'Edit', columntype: 'button', cellsrenderer: function () { return "Edit"; }, buttonclick: function (row) { // open the popup window when the user clicks a button. editrow = row; - $("#popupWindow").jqxWindow({ position: { x: 80, y: 10 } }); + $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); // get the clicked row's data and initialize the input fields. var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); $("#name").val(dataRecord.name); @@ -210,6 +223,7 @@ $("#caryophyllene").val(dataRecord.caryophyllene); $("#cohumulone").val(dataRecord.cohumulone); $("#myrcene").val(dataRecord.myrcene); + $("#hsi").val(dataRecord.hsi); $("#useat").val(dataRecord.useat); $("#type").val(dataRecord.type); $("#form").val(dataRecord.form); @@ -222,6 +236,7 @@ $("#production_date").val(dataRecord.production_date); $("#tht_date").val(dataRecord.tht_date); $("#supplier_rec").val(dataRecord.supplier_rec); + $("#total_oil").val(dataRecord.total_oil); // show the popup window. $("#popupWindow").jqxWindow('open'); } @@ -262,6 +277,7 @@ caryophyllene: parseFloat($("#caryophyllene").jqxNumberInput('decimal')), cohumulone: parseFloat($("#cohumulone").jqxNumberInput('decimal')), myrcene: parseFloat($("#myrcene").jqxNumberInput('decimal')), + hsi: parseFloat($("#hsi").jqxNumberInput('decimal')), useat: $("#useat").val(), type: $("#type").val(), form: $("#form").val(), @@ -273,7 +289,8 @@ cost: parseFloat($("#cost").jqxNumberInput('decimal')), production_date: $("#production_date").val(), tht_date: $("#tht_date").val(), - supplier_rec: parseFloat($("#supplier_rec").jqxNumberInput('decimal')) + supplier_rec: parseFloat($("#supplier_rec").jqxNumberInput('decimal')), + total_oil: parseFloat($("#total_oil").jqxNumberInput('decimal')) }; $('#jqxgrid').jqxGrid('updaterow', rowID, row); $("#popupWindow").jqxWindow('hide'); @@ -288,6 +305,7 @@ caryophyllene: parseFloat($("#caryophyllene").jqxNumberInput('decimal')), cohumulone: parseFloat($("#cohumulone").jqxNumberInput('decimal')), myrcene: parseFloat($("#myrcene").jqxNumberInput('decimal')), + hsi: parseFloat($("#hsi").jqxNumberInput('decimal')), useat: $("#useat").val(), type: $("#type").val(), form: $("#form").val(), @@ -299,7 +317,8 @@ cost: parseFloat($("#cost").jqxNumberInput('decimal')), production_date: $("#production_date").val(), tht_date: $("#tht_date").val(), - supplier_rec: parseFloat($("#supplier_rec").jqxNumberInput('decimal')) + supplier_rec: parseFloat($("#supplier_rec").jqxNumberInput('decimal')), + total_oil: parseFloat($("#total_oil").jqxNumberInput('decimal')) }; $('#jqxgrid').jqxGrid('addrow', null, newrow); $("#popupWindow").jqxWindow('hide');