www/inv_instock.php

Fri, 28 Sep 2018 17:29:23 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 28 Sep 2018 17:29:23 +0200
changeset 72
93a0be4f5be3
parent 33
2ee6ad5d6f14
child 77
a9f8de2d7b2b
permissions
-rw-r--r--

Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.

<?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("%-60s %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,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 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;
	$hop = $row['form'] . " " . $row['origin'] . " - " . $row['name'];
	$stock = floatval($row['inventory']) * 1000.0;
//	printf("%-60s %10.1f gr  %8.2f  %8.2f \n", $hop, $stock, $row['cost'], $value);
}
printf("                                                                                      --------\n");
printf("Totaal                                                                                %8.2f\n\n", $tot_hops );

$tot_yeasts = 0.0;
$result = $mysqli->query("SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0");
printf("Gisten                                                         Voorraad     Prijs/kg    Waarde\n");
printf("------------------------------------------------------------ ----------     --------  --------\n");
while($row = $result->fetch_array(MYSQLI_ASSOC)) {
	$value = $row['inventory'] * $row['cost'];
	$yeast = $row['laboratory'] . " " .$row['product_id'] . " - " . $row['name'];
	$tot_yeasts += $value;
	$stock = floatval($row['inventory']) * 1000.0;
	($row['form'] == 'Dry') ? $amount = "gr" : $amount = "ml";
//        printf("%-60s %10.1f %s  %8.2f  %8.2f \n", $yeast, $stock, $amount, $row['cost'], $value);
}
printf("                                                                                      --------\n");
printf("Totaal                                                                                %8.2f\n\n", $tot_yeasts );

$tot_miscs = 0.0;
$result = $mysqli->query("SELECT name,type,amount_is_weight,inventory,cost FROM inventory_miscs WHERE inventory > 0");
printf("Diverse ingredienten                                           Voorraad     Prijs/kg    Waarde\n");
printf("------------------------------------------------------------ ----------     --------  --------\n");
while($row = $result->fetch_array(MYSQLI_ASSOC)) {
        $value = $row['inventory'] * $row['cost'];
        $misc  = $row['type'] . " " . $row['name'];
        $tot_miscs += $value;
        $stock = floatval($row['inventory']) * 1000.0;
        ($row['amount_is_weight']) ? $amount = "gr" : $amount = "ml";
        printf("%-60s %10.1f %s  %8.2f  %8.2f \n", $misc, $stock, $amount, $row['cost'], $value);
}
printf("                                                                                      --------\n");
printf("Totaal                                                                                %8.2f\n\n", $tot_miscs );
?>
    </pre>
   </div>

<?php
page_footer();
?>

mercurial