Added archive view on date and code.

Mon, 25 Feb 2019 13:27:41 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 25 Feb 2019 13:27:41 +0100
changeset 292
90cd3798edc2
parent 291
869247533c5f
child 293
db898ec73277

Added archive view on date and code.

www/Makefile file | annotate | diff | comparison | revisions
www/includes/db_product.php file | annotate | diff | comparison | revisions
www/includes/global.inc.php file | annotate | diff | comparison | revisions
www/js/prod_archive_code.js file | annotate | diff | comparison | revisions
www/js/prod_archive_date.js file | annotate | diff | comparison | revisions
www/js/prod_archive_name.js file | annotate | diff | comparison | revisions
www/prod_archive_code.php file | annotate | diff | comparison | revisions
www/prod_archive_date.php file | annotate | diff | comparison | revisions
www/prod_archive_name.php file | annotate | diff | comparison | revisions
--- 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 \
--- 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;
 	}
 
 	/*
--- 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 @@
        <li>Archief
 	<ul>
          <li><a href="prod_archive_name.php">Op naam</a></li>
-         <li>Op code</li>
-         <li>Op datum</li>
+         <li><a href="prod_archive_code.php">Op code</a></li>
+         <li><a href="prod_archive_date.php">Op datum</a></li>
         </ul>
        </li>
        <li>Import
--- /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 <mbroek at mbse dot eu>
+ *
+ * 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;
+				}
+			}
+		],
+	});
+});
--- /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 <mbroek at mbse dot eu>
+ *
+ * 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']
+	});
+});
--- 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];
--- /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 @@
+<?php
+require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
+page_header('Producten archief op code', 'prod_archive_code');
+?>
+
+   <div id="jqxgrid"></div>
+    <div style="margin-top: 30px;">
+    <div id="cellbegineditevent"></div>
+    <div style="margin-top: 10px;" id="cellendeditevent"></div>
+   </div>
+
+<?php
+page_footer();
+?>
--- /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 @@
+<?php
+require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
+page_header('Producten archief op datum', 'prod_archive_date');
+?>
+
+   <div id="jqxgrid"></div>
+    <div style="margin-top: 30px;">
+    <div id="cellbegineditevent"></div>
+    <div style="margin-top: 10px;" id="cellendeditevent"></div>
+   </div>
+
+<?php
+page_footer();
+?>
--- 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 @@
 <?php
 require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
-page_header('Producten archief', 'prod_archive_name');
+page_header('Producten archief op naam', 'prod_archive_name');
 ?>
 
    <div id="jqxgrid"></div>

mercurial