Inventory fermentables and hops to standard weight format.

Sun, 19 Aug 2018 15:36:13 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 19 Aug 2018 15:36:13 +0200
changeset 30
f5ab22446aa5
parent 29
a12d0a4d621e
child 31
d7b40a7d8ac6

Inventory fermentables and hops to standard weight format.

README.design file | annotate | diff | comparison | revisions
www/import/from_brouwhulp.php file | annotate | diff | comparison | revisions
www/includes/db_inventory_hops.php file | annotate | diff | comparison | revisions
www/includes/global.inc.php file | annotate | diff | comparison | revisions
www/inv_instock.php file | annotate | diff | comparison | revisions
www/js/inv_fermentables.js file | annotate | diff | comparison | revisions
www/js/inv_hops.js file | annotate | diff | comparison | revisions
--- a/README.design	Sat Aug 18 23:13:07 2018 +0200
+++ b/README.design	Sun Aug 19 15:36:13 2018 +0200
@@ -30,8 +30,8 @@
 Database inventaris:		Werking	Maten
 ----------------------------	-------	-------
 inventory_equipments		Ok.	Ok.
-inventory_fermentables		Ok.
-inventory_hops			Ok.
+inventory_fermentables		Ok.	Ok.
+inventory_hops			Ok.	Ok.
 inventory_mash_profiles		Ok zonder de steps.
 inventory_miscs			Ok.
 inventory_styles		Ok.	Ok.
--- a/www/import/from_brouwhulp.php	Sat Aug 18 23:13:07 2018 +0200
+++ b/www/import/from_brouwhulp.php	Sun Aug 19 15:36:13 2018 +0200
@@ -118,7 +118,7 @@
 		$sql .= "', substitutes='" . mysqli_real_escape_string($db, $hop->SUBSTITUTES);
 		($hop->ALWAYS_ON_STOCK == 'TRUE') ? $sql .= "', always_on_stock='1" : $sql .= "', always_on_stock='0";
 		if ($hop->INVENTORY)
-			$sql .= "', inventory='" . $hop->INVENTORY;
+			$sql .= "', inventory='" . $hop->INVENTORY / 1000.0;
 		if ($hop->COST)
 			$sql .= "', cost='" . $hop->COST;
 		if ($hop->TOTAL_OIL)
@@ -433,8 +433,8 @@
 
 
 
-//do_fermentables();
-//do_hops();
+do_fermentables();
+do_hops();
 //do_yeasts();
 //do_miscs();
 //do_waters();
--- a/www/includes/db_inventory_hops.php	Sat Aug 18 23:13:07 2018 +0200
+++ b/www/includes/db_inventory_hops.php	Sun Aug 19 15:36:13 2018 +0200
@@ -28,7 +28,7 @@
 	$sql .= "', origin='" . mysqli_real_escape_string($connect, $_GET['origin']);
 	$sql .= "', substitutes='" . mysqli_real_escape_string($connect, $_GET['substitutes']);
 	($_GET['always_on_stock'] == 'true') ? $sql .= "', always_on_stock='1" : $sql .= "', always_on_stock='0";
-	$sql .= "', inventory='" . $_GET['inventory'];
+	$sql .= "', inventory='" . $_GET['inventory'] / 1000.0;
 	$sql .= "', cost='" . $_GET['cost'];
 	$sql .= "', production_date='" . $_GET['production_date'];
 	$sql .= "', tht_date='" . $_GET['tht_date'];
@@ -58,7 +58,7 @@
 	$sql .= "', origin='" . mysqli_real_escape_string($connect, $_GET['origin']);
 	$sql .= "', substitutes='" . mysqli_real_escape_string($connect, $_GET['substitutes']);
 	($_GET['always_on_stock'] == 'true') ? $sql .= "', always_on_stock='1" : $sql .= "', always_on_stock='0";
-	$sql .= "', inventory='" . $_GET['inventory'];
+	$sql .= "', inventory='" . $_GET['inventory'] / 1000.0;
 	$sql .= "', cost='" . $_GET['cost'];
 	$sql .= "', production_date='" . $_GET['production_date'];
 	$sql .= "', tht_date='" . $_GET['tht_date'];
@@ -103,7 +103,7 @@
 			'origin' => $row['origin'],
 			'substitutes' => $row['substitutes'],
 			'always_on_stock' => $row['always_on_stock'],
-			'inventory' => $row['inventory'],
+			'inventory' => $row['inventory'] * 1000,
 			'cost' => $row['cost'],
 			'production_date' => $row['production_date'],
 			'tht_date' => $row['tht_date'],
--- a/www/includes/global.inc.php	Sat Aug 18 23:13:07 2018 +0200
+++ b/www/includes/global.inc.php	Sun Aug 19 15:36:13 2018 +0200
@@ -26,13 +26,9 @@
  *
  * energyblue of ui-redmond
  */
-//$my_style = 'ui-redmond';
 //$my_style = 'black';
-//$my_style = 'dark';
-//$my_style = 'metrodark';
-$my_style = 'ui-darkness';
-//$my_style = 'ui-start';
-//$my_style = 'ui-sunny';
+//$my_style = 'ui-darkness';
+$my_style = 'ui-mbse';
 //$my_style = 'android';
 
 require_once($_SERVER['DOCUMENT_ROOT'].'/config.php');
@@ -133,6 +129,7 @@
        <li><a href="inv_mash_profiles.php">Maisch schemas</a></li>
        <li><a href="inv_equipments.php">Brouw apparatuur</a></li>
        <li><a href="inv_styles.php">Bierstijlen</a></li>
+       <li><a href="inv_instock.php">Voorraad lijst</a></li>
       </ul>
      </li>
      <li>Over
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/www/inv_instock.php	Sun Aug 19 15:36:13 2018 +0200
@@ -0,0 +1,54 @@
+<?php
+require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
+page_header('Hoofdmenu', NULL);
+?>
+
+   <div id="MainPanel">
+    <div id="ContentPanel"></div>
+    <pre>
+<?php
+$mysqli = new mysqli(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
+$result = $mysqli->query("SELECT name,inventory,cost FROM inventory_fermentables WHERE inventory > 0");
+$tot_fermentables = 0.0;
+printf("Vergistbaar ingredient                     Voorraad     Prijs/kg    Waarde\n");
+printf("---------------------------------------- ----------     --------  --------\n");
+while($row = $result->fetch_array(MYSQLI_ASSOC)) {
+	$value = $row['inventory'] * $row['cost'];
+	$tot_fermentables += $value;
+//	printf("%-40s %10.5f kg  %8.2f  %8.2f \n", $row['name'], $row['inventory'], $row['cost'], $value);
+}
+printf("----------------------------------------                          --------\n");
+printf("Totaal                                                            %8.2f\n\n", $tot_fermentables);
+
+$tot_hops = 0.0;
+$result = $mysqli->query("SELECT name,inventory,cost FROM inventory_hops WHERE inventory > 0");
+$tot_fermentables = 0.0;
+printf("Hoppen                                     Voorraad     Prijs/kg    Waarde\n");
+printf("---------------------------------------- ----------     --------  --------\n");
+while($row = $result->fetch_array(MYSQLI_ASSOC)) {
+        $value = $row['inventory'] * $row['cost'];
+        $tot_hops += $value;
+	printf("%-40s %10.5f kg  %8.2f  %8.2f \n", $row['name'], $row['inventory'], $row['cost'], $value);
+}
+printf("----------------------------------------                          --------\n\n");
+printf("Totaal                                                            %8.2f\n", $tot_hops );
+
+$tot_yeats = 0.0;
+$result = $mysqli->query("SELECT name,inventory,cost FROM inventory_yeasts WHERE inventory > 0");
+$tot_fermentables = 0.0;
+printf("Hoppen                                     Voorraad     Prijs/kg    Waarde\n");
+printf("---------------------------------------- ----------     --------  --------\n");
+while($row = $result->fetch_array(MYSQLI_ASSOC)) {
+        $value = $row['inventory'] * $row['cost'];
+        $tot_yeasts += $value;
+        printf("%-40s %10.5f kg  %8.2f  %8.2f \n", $row['name'], $row['inventory'], $row['cost'], $value);
+}
+printf("----------------------------------------                          --------\n\n");
+printf("Totaal                                                            %8.2f\n", $tot_yeasts );
+?>
+    </pre>
+   </div>
+
+<?php
+page_footer();
+?>
--- a/www/js/inv_fermentables.js	Sat Aug 18 23:13:07 2018 +0200
+++ b/www/js/inv_fermentables.js	Sun Aug 19 15:36:13 2018 +0200
@@ -200,15 +200,15 @@
 		filtermode: 'excel',
 		columns: [
 			{ text: 'Vergistbaar product', datafield: 'name', width: 250 },
-			{ text: 'Soort', datafield: 'type', width: 90 },
-			{ text: 'Mout type', datafield: 'graintype', width: 90 },
+			{ text: 'Soort', datafield: 'type', align: 'center', cellsalign: 'center', width: 90 },
+			{ text: 'Mout type', datafield: 'graintype', align: 'center', cellsalign: 'center', width: 90 },
 			{ text: 'Herkomst', datafield: 'origin', width: 150 },
 			{ text: 'Producent', datafield: 'supplier', width: 150 },
-			{ text: 'Kleur', datafield: 'color', width: 70, cellsalign: 'right' },
-			{ text: 'Opbrengst', datafield: 'yield', width: 70, cellsalign: 'right' },
-			{ text: 'Inv.', datafield: 'inventory', width: 70, cellsalign: 'right' },
-			{ text: 'Prijs', datafield: 'cost', width: 70, cellsalign: 'right', cellsformat: 'c2' },
-			{ text: 'Edit', datafield: 'Edit', width: 120, columntype: 'button', cellsrenderer: function () {
+			{ text: 'Kleur', datafield: 'color', width: 70, align: 'right', cellsalign: 'right' },
+			{ text: 'Opbrengst', datafield: 'yield', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
+			{ text: 'Vooraad', datafield: 'inventory', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
+			{ text: 'Prijs', datafield: 'cost', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'c2' },
+			{ text: 'Edit', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () {
 				return "Edit";
 				}, buttonclick: function (row) {
 					// open the popup window when the user clicks a button.
--- a/www/js/inv_hops.js	Sat Aug 18 23:13:07 2018 +0200
+++ b/www/js/inv_hops.js	Sun Aug 19 15:36:13 2018 +0200
@@ -191,17 +191,17 @@
 		filtermode: 'excel',
 		columns: [
 			{ 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 () {
+			{ text: 'Soort', datafield: 'type', align: 'center', cellsalign: 'center', width: 90 },
+			{ text: 'Vorm', datafield: 'form', align: 'center', cellsalign: 'center', width: 90 },
+			{ text: 'Alpha %', datafield: 'alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
+			{ text: 'Beta %', datafield: 'beta', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
+			{ text: 'Cohumuloon %%', datafield: 'cohumulone', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
+			{ text: 'HSI', datafield: 'hsi', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
+			{ text: 'Herkomst', datafield: 'origin', align: 'center', cellsalign: 'center', width: 150 },
+			{ text: 'Oogst datum', datafield: 'production_date', align: 'center', cellsalign: 'center', width: 100 },
+			{ text: 'Voor, gr.', datafield: 'inventory', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
+			{ text: 'Prijs /kg', datafield: 'cost', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'c2' },
+			{ text: 'Edit', datafield: 'Edit', columntype: 'button', align: 'center', cellsrenderer: function () {
 				return "Edit";
 				}, buttonclick: function (row) {
 					// open the popup window when the user clicks a button.

mercurial