# HG changeset patch # User Michiel Broek # Date 1551097661 -3600 # Node ID 90cd3798edc272f9a86f733751b2a23b48bbb541 # Parent 869247533c5fcf378744d413c98d278f5ea4c161 Added archive view on date and code. diff -r 869247533c5f -r 90cd3798edc2 www/Makefile --- a/www/Makefile Sun Feb 24 23:26:51 2019 +0100 +++ b/www/Makefile Mon Feb 25 13:27:41 2019 +0100 @@ -10,7 +10,7 @@ inv_equipments.php inv_fermentables.php inv_hops.php inv_instock.php \ inv_miscs.php inv_suppliers.php inv_waters.php inv_yeasts.php \ log_fermentation.php mon_brewer.php mon_fermenter.php mon_node.php \ - prod_archive_name.php \ + prod_archive_code.php prod_archive_date.php prod_archive_name.php \ prod_edit.php prod_export.php prod_inprod.php prod_new.php prod_print.php \ prod_reduce.php profile_fermentation.php \ profile_mash.php profile_setup.php profile_styles.php profile_water.php \ diff -r 869247533c5f -r 90cd3798edc2 www/includes/db_product.php --- a/www/includes/db_product.php Sun Feb 24 23:26:51 2019 +0100 +++ b/www/includes/db_product.php Mon Feb 25 13:27:41 2019 +0100 @@ -437,19 +437,62 @@ } if (isset($_GET['select']) && ($_GET['select'] == "archname")) { - $query = "SELECT record,name,code,birth,batch_size FROM products WHERE stage = '11' ORDER BY name,birth;"; + $query = "SELECT record,name,code,brew_date_start,st_name,og,fg,batch_size FROM products WHERE stage = '11' ORDER BY name,brew_date_start;"; + $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); + while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { + $brews[] = array( + 'record' => $row['record'], + 'name' => $row['name'], + 'code' => $row['code'], + 'date' => substr($row['brew_date_start'], 0, 10), + 'style' => $row['st_name'], + 'og' => $row['og'], + 'fg' => $row['fg'], + 'batch_size' => $row['batch_size'] + ); + } + syslog(LOG_NOTICE, json_encode($brews, JSON_UNESCAPED_UNICODE)); + echo json_encode($brews, JSON_UNESCAPED_UNICODE); + return; + } + + if (isset($_GET['select']) && ($_GET['select'] == "archcode")) { + $query = "SELECT record,name,code,brew_date_start,st_name,og,fg,batch_size FROM products WHERE stage = '11' ORDER BY code;"; $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $brews[] = array( 'record' => $row['record'], 'name' => $row['name'], 'code' => $row['code'], - 'birth' => $row['birth'], + 'date' => substr($row['brew_date_start'], 0, 10), + 'style' => $row['st_name'], + 'og' => $row['og'], + 'fg' => $row['fg'], 'batch_size' => $row['batch_size'] ); } - echo json_encode($brews, JSON_UNESCAPED_UNICODE); - return; + echo json_encode($brews, JSON_UNESCAPED_UNICODE); + return; + } + + if (isset($_GET['select']) && ($_GET['select'] == "archdate")) { + $query = "SELECT record,name,code,brew_date_start,st_name,og,fg,batch_size FROM products WHERE stage = '11' ORDER BY brew_date_start;"; + $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); + while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { + $brews[] = array( + 'record' => $row['record'], + 'name' => $row['name'], + 'code' => $row['code'], + 'year' => substr($row['brew_date_start'], 0, 4), + 'date' => substr($row['brew_date_start'], 0, 10), + 'style' => $row['st_name'], + 'og' => $row['og'], + 'fg' => $row['fg'], + 'batch_size' => $row['batch_size'] + ); + } + echo json_encode($brews, JSON_UNESCAPED_UNICODE); + return; } /* diff -r 869247533c5f -r 90cd3798edc2 www/includes/global.inc.php --- a/www/includes/global.inc.php Sun Feb 24 23:26:51 2019 +0100 +++ b/www/includes/global.inc.php Mon Feb 25 13:27:41 2019 +0100 @@ -218,8 +218,8 @@
  • Archief
  • Import diff -r 869247533c5f -r 90cd3798edc2 www/js/prod_archive_code.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www/js/prod_archive_code.js Mon Feb 25 13:27:41 2019 +0100 @@ -0,0 +1,66 @@ +/***************************************************************************** + * Copyright (C) 2019 + * + * Michiel Broek + * + * This file is part of BMS + * + * 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. + *****************************************************************************/ + + +$(document).ready(function () { + var source = { + datatype: "json", + cache: false, + datafields: [ + { name: 'record', type: 'number' }, + { name: 'name', type: 'string' }, + { name: 'code', type: 'string' }, + { name: 'date', type: 'string' }, + { name: 'style', type: 'string' }, + { name: 'og', type: 'float' }, + { name: 'fg', type: 'float' }, + { name: 'batch_size', type: 'float' }, + ], + id: 'record', + url: "includes/db_product.php?select=archcode" + }; + var dataAdapter = new $.jqx.dataAdapter(source); + // initialize jqxGrid + $("#jqxgrid").jqxGrid({ + width: 1280, + height: 630, + source: dataAdapter, + theme: theme, + columns: [ + { text: 'Code', datafield: 'code', width: 100 }, + { text: 'Naam', datafield: 'name' }, + { text: 'Stijl', datafield: 'style', width: 250 }, + { text: 'OG', datafield: 'og', width: 80, cellsformat: 'f3' }, + { text: 'FG', datafield: 'fg', width: 80, cellsformat: 'f3' }, + { text: 'Datum', datafield: 'date', width: 120 }, + { text: 'Liters', datafield: 'batch_size', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, + { text: '', datafield: 'Edit', width: 80, align: 'center', columntype: 'button', cellsrenderer: function () { + return "Bekijk"; + }, buttonclick: function (row) { + var datarecord = dataAdapter.records[row]; + var url= "prod_edit.php?record=" + datarecord.record + "&select=archcode&return=prod_archive_code.php"; + window.location.href = url; + } + } + ], + }); +}); diff -r 869247533c5f -r 90cd3798edc2 www/js/prod_archive_date.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www/js/prod_archive_date.js Mon Feb 25 13:27:41 2019 +0100 @@ -0,0 +1,70 @@ +/***************************************************************************** + * Copyright (C) 2019 + * + * Michiel Broek + * + * This file is part of BMS + * + * 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. + *****************************************************************************/ + + +$(document).ready(function () { + var source = { + datatype: "json", + cache: false, + datafields: [ + { name: 'record', type: 'number' }, + { name: 'name', type: 'string' }, + { name: 'code', type: 'string' }, + { name: 'year', type: 'string' }, + { name: 'date', type: 'string' }, + { name: 'style', type: 'string' }, + { name: 'og', type: 'float' }, + { name: 'fg', type: 'float' }, + { name: 'batch_size', type: 'float' }, + ], + id: 'record', + url: "includes/db_product.php?select=archdate" + }; + var dataAdapter = new $.jqx.dataAdapter(source); + // initialize jqxGrid + $("#jqxgrid").jqxGrid({ + width: 1280, + height: 630, + source: dataAdapter, + groupable: true, + theme: theme, + columns: [ + { text: 'Jaar', datafield: 'year', width: 80 }, + { text: 'Datum', datafield: 'date', width: 120, menu: false }, + { text: 'Naam', datafield: 'name', menu: false }, + { text: 'Stijl', datafield: 'style', width: 250 }, + { text: 'OG', datafield: 'og', width: 80, cellsformat: 'f3', menu: false }, + { text: 'FG', datafield: 'fg', width: 80, cellsformat: 'f3', menu: false }, + { text: 'Code', datafield: 'code', width: 100, menu: false }, + { text: 'Liters', datafield: 'batch_size', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', menu: false }, + { text: '', datafield: 'Edit', width: 80, align: 'center', columntype: 'button', cellsrenderer: function () { + return "Bekijk"; + }, buttonclick: function (row) { + var datarecord = dataAdapter.records[row]; + var url= "prod_edit.php?record=" + datarecord.record + "&select=archdate&return=prod_archive_date.php"; + window.location.href = url; + } + } + ], + groups: ['year'] + }); +}); diff -r 869247533c5f -r 90cd3798edc2 www/js/prod_archive_name.js --- a/www/js/prod_archive_name.js Sun Feb 24 23:26:51 2019 +0100 +++ b/www/js/prod_archive_name.js Mon Feb 25 13:27:41 2019 +0100 @@ -29,7 +29,10 @@ { name: 'record', type: 'number' }, { name: 'name', type: 'string' }, { name: 'code', type: 'string' }, - { name: 'birth', type: 'string' }, + { name: 'date', type: 'string' }, + { name: 'style', type: 'string' }, + { name: 'og', type: 'float' }, + { name: 'fg', type: 'float' }, { name: 'batch_size', type: 'float' }, ], id: 'record', @@ -44,10 +47,13 @@ theme: theme, columns: [ { text: 'Naam', datafield: 'name' }, - { text: 'Datum', datafield: 'birth', width: 120 }, - { text: 'Code', datafield: 'code', width: 120 }, - { text: 'Liters', datafield: 'batch_size', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function () { + { text: 'Stijl', datafield: 'style', width: 250 }, + { text: 'OG', datafield: 'og', width: 80, cellsformat: 'f3' }, + { text: 'FG', datafield: 'fg', width: 80, cellsformat: 'f3' }, + { text: 'Datum', datafield: 'date', width: 120 }, + { text: 'Code', datafield: 'code', width: 100 }, + { text: 'Liters', datafield: 'batch_size', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, + { text: '', datafield: 'Edit', width: 80, align: 'center', columntype: 'button', cellsrenderer: function () { return "Bekijk"; }, buttonclick: function (row) { var datarecord = dataAdapter.records[row]; diff -r 869247533c5f -r 90cd3798edc2 www/prod_archive_code.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www/prod_archive_code.php Mon Feb 25 13:27:41 2019 +0100 @@ -0,0 +1,14 @@ + + +
    +
    +
    +
    +
    + + diff -r 869247533c5f -r 90cd3798edc2 www/prod_archive_date.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www/prod_archive_date.php Mon Feb 25 13:27:41 2019 +0100 @@ -0,0 +1,14 @@ + + +
    +
    +
    +
    +
    + + diff -r 869247533c5f -r 90cd3798edc2 www/prod_archive_name.php --- a/www/prod_archive_name.php Sun Feb 24 23:26:51 2019 +0100 +++ b/www/prod_archive_name.php Mon Feb 25 13:27:41 2019 +0100 @@ -1,6 +1,6 @@