www/inv_instock.php

Sat, 22 Sep 2018 15:02:43 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 22 Sep 2018 15:02:43 +0200
changeset 60
dbbe408108ea
parent 33
2ee6ad5d6f14
child 77
a9f8de2d7b2b
permissions
-rw-r--r--

Added miscs inline editor. Switched to http POST because of GET limitations.

<?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