# HG changeset patch # User Michiel Broek # Date 1552509064 -3600 # Node ID f0ca77097236b730627c42f3a83d8fee50af02b6 # Parent 8d7fad771dde91be6c5362647c108e47b24a2029 Display alcohol tolerance in the yeast editor. Display in red when the recipe estimate is higher then the yeast tolerance. diff -r 8d7fad771dde -r f0ca77097236 www/includes/db_product.php --- a/www/includes/db_product.php Wed Mar 13 20:17:15 2019 +0100 +++ b/www/includes/db_product.php Wed Mar 13 21:31:04 2019 +0100 @@ -348,6 +348,7 @@ $yeast .= ',"y_flocculation":' . $item['y_flocculation']; $yeast .= ',"y_attenuation":' . $item['y_attenuation']; $yeast .= ',"y_cells":' . $item['y_cells']; + $yeast .= ',"y_tolerance":' . $item['y_tolerance']; $yeast .= ',"y_inventory":' . $item['y_inventory']; $yeast .= ',"y_use":' . $item['y_use']; $yeast .= ',"y_cost":' . $item['y_cost'] . '}'; @@ -783,7 +784,7 @@ for ($i = 0; $i < count($yeasts); $i++) { $yeasts[$i]['y_inventory'] = 0; // Not in stock $yeasts[$i]['y_avail'] = 0; // Ingredient not in db - $sql2 = "SELECT inventory FROM inventory_yeasts "; + $sql2 = "SELECT inventory,tolerance FROM inventory_yeasts "; $sql2 .= "WHERE name='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_name'])."' AND"; $sql2 .= " form='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_form'])."' AND"; $sql2 .= " laboratory='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_laboratory'])."' AND"; @@ -792,6 +793,9 @@ if ($obj = mysqli_fetch_object($result2)) { $yeasts[$i]['y_inventory'] = floatval($obj->inventory); $yeasts[$i]['y_avail'] = 1; + if ($yeasts[$i]['y_tolerance'] == 0) { + $yeasts[$i]['y_tolerance'] = floatval($obj->tolerance); // Upgrade alcohol tolerance + } } mysqli_free_result($result2); } diff -r 8d7fad771dde -r f0ca77097236 www/includes/db_recipes.php --- a/www/includes/db_recipes.php Wed Mar 13 20:17:15 2019 +0100 +++ b/www/includes/db_recipes.php Wed Mar 13 21:31:04 2019 +0100 @@ -217,6 +217,7 @@ $yeast .= ',"y_flocculation":' . $item['y_flocculation']; $yeast .= ',"y_attenuation":' . $item['y_attenuation']; $yeast .= ',"y_cells":' . $item['y_cells']; + $yeast .= ',"y_tolerance":' . $item['y_tolerance']; $yeast .= ',"y_inventory":' . $item['y_inventory']; $yeast .= ',"y_use":' . $item['y_use']; $yeast .= ',"y_cost":' . $item['y_cost'] . '}'; @@ -428,7 +429,7 @@ for ($i = 0; $i < count($yeasts); $i++) { $yeasts[$i]['y_inventory'] = 0; // Not in stock $yeasts[$i]['y_avail'] = 0; // Ingredient not in db - $sql2 = "SELECT inventory FROM inventory_yeasts "; + $sql2 = "SELECT inventory,tolerance FROM inventory_yeasts "; $sql2 .= "WHERE name='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_name'])."' AND"; $sql2 .= " form='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_form'])."' AND"; $sql2 .= " laboratory='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_laboratory'])."' AND"; @@ -437,6 +438,9 @@ if ($obj = mysqli_fetch_object($result2)) { $yeasts[$i]['y_inventory'] = floatval($obj->inventory); $yeasts[$i]['y_avail'] = 1; + if ($yeasts[$i]['y_tolerance'] == 0) { + $yeasts[$i]['y_tolerance'] = floatval($obj->tolerance); // Upgrade alcohol tolerance + } } mysqli_free_result($result2); } diff -r 8d7fad771dde -r f0ca77097236 www/js/prod_edit.js --- a/www/js/prod_edit.js Wed Mar 13 20:17:15 2019 +0100 +++ b/www/js/prod_edit.js Wed Mar 13 21:31:04 2019 +0100 @@ -3672,6 +3672,7 @@ { name: 'y_attenuation', type: 'float' }, { name: 'y_use', type: 'int' }, { name: 'y_cells', type: 'float' }, + { name: 'y_tolerance', type: 'float' }, { name: 'y_inventory', type: 'float' }, { name: 'y_avail', type: 'int' } ], @@ -3733,6 +3734,7 @@ row["y_attenuation"] = datarecord.attenuation; row["y_flocculation"] = datarecord.flocculation; row["y_cells"] = datarecord.cells; + row["y_tolerance"] = datarecord.tolerance; row["y_inventory"] = datarecord.inventory; var commit = $("#yeastGrid").jqxGrid('addrow', null, row); } @@ -3773,13 +3775,25 @@ }, { text: 'Min. °C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_min_temperature' }, { text: 'Max. °C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' }, + { text: 'Tol. %', width: 60, align: 'right', cellsalign: 'right', datafield: 'y_tolerance', + cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { + var color = '#ffffff'; + var amount = ""; + if (value > 0) { + amount = dataAdapter.formatNumber(value, "f1"); + if (dataRecord.est_abv > value) + color = '#ff4040'; + } + return '' + amount + ''; + } + }, { text: 'Attn. %', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_attenuation', cellsformat: 'f1' }, { text: 'Voor', width: 120, datafield: 'y_use', cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { return '' + YeastUseData[value].nl + ''; } }, - { text: 'Hoeveel', datafield: 'y_amount', width: 100, align: 'right', + { text: 'Hoeveel', datafield: 'y_amount', width: 90, align: 'right', cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { var amount = dataAdapter.formatNumber(value*1000, "f0")+" ml"; if (rowdata.y_form == 0) // Liquid @@ -3789,7 +3803,7 @@ return '' + amount + ''; } }, - { text: 'Voorraad', datafield: 'y_inventory', width: 100, align: 'right', + { text: 'Voorraad', datafield: 'y_inventory', width: 90, align: 'right', cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { var color = '#ffffff'; if (value < rowdata.y_amount) @@ -3802,7 +3816,7 @@ return '' + amount + ''; } }, - { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { + { text: '', datafield: 'Edit', columntype: 'button', width: 90, align: 'center', cellsrenderer: function () { return "Wijzig"; }, buttonclick: function (row) { if (dataRecord.stage <= 3) { diff -r 8d7fad771dde -r f0ca77097236 www/js/rec_edit.js --- a/www/js/rec_edit.js Wed Mar 13 20:17:15 2019 +0100 +++ b/www/js/rec_edit.js Wed Mar 13 21:31:04 2019 +0100 @@ -2356,6 +2356,7 @@ { name: 'y_attenuation', type: 'float' }, { name: 'y_use', type: 'int' }, { name: 'y_cells', type: 'float' }, + { name: 'y_tolerance', type: 'float' }, { name: 'y_inventory', type: 'float' }, { name: 'y_avail', type: 'int' } ], @@ -2416,6 +2417,7 @@ row["y_attenuation"] = datarecord.attenuation; row["y_flocculation"] = datarecord.flocculation; row["y_cells"] = datarecord.cells; + row["y_tolerance"] = datarecord.tolerance; row["y_inventory"] = datarecord.inventory; var commit = $("#yeastGrid").jqxGrid('addrow', null, row); } @@ -2452,13 +2454,25 @@ }, { text: 'Min. °C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_min_temperature' }, { text: 'Max. °C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' }, + { text: 'Tol. %', width: 60, align: 'right', cellsalign: 'right', datafield: 'y_tolerance', + cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { + var color = '#ffffff'; + var amount = ""; + if (value > 0) { + amount = dataAdapter.formatNumber(value, "f1"); + if (dataRecord.est_abv > value) + color = '#ff4040'; + } + return '' + amount + ''; + } + }, { text: 'Attn. %', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_attenuation', cellsformat: 'f1' }, { text: 'Voor', width: 120, datafield: 'y_use', cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { return '' + YeastUseData[value].nl + ''; } }, - { text: 'Hoeveel', datafield: 'y_amount', width: 100, align: 'right', + { text: 'Hoeveel', datafield: 'y_amount', width: 90, align: 'right', cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { var amount = dataAdapter.formatNumber(value*1000, "f0")+" ml"; if (rowdata.y_form == 0) // Liquid @@ -2468,7 +2482,7 @@ return '' + amount + ''; } }, - { text: 'Voorraad', datafield: 'y_inventory', width: 100, align: 'right', + { text: 'Voorraad', datafield: 'y_inventory', width: 90, align: 'right', cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { var color = '#ffffff'; if (value < rowdata.y_amount) @@ -2481,7 +2495,7 @@ return '' + amount + ''; } }, - { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { + { text: '', datafield: 'Edit', columntype: 'button', width: 90, align: 'center', cellsrenderer: function () { return "Wijzig"; }, buttonclick: function (row) { yeastRow = row;