www/inv_instock.php

changeset 33
2ee6ad5d6f14
parent 30
f5ab22446aa5
child 77
a9f8de2d7b2b
equal deleted inserted replaced
32:8bb369f32ef9 33:2ee6ad5d6f14
8 <pre> 8 <pre>
9 <?php 9 <?php
10 $mysqli = new mysqli(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME); 10 $mysqli = new mysqli(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
11 $result = $mysqli->query("SELECT name,inventory,cost FROM inventory_fermentables WHERE inventory > 0"); 11 $result = $mysqli->query("SELECT name,inventory,cost FROM inventory_fermentables WHERE inventory > 0");
12 $tot_fermentables = 0.0; 12 $tot_fermentables = 0.0;
13 printf("Vergistbaar ingredient Voorraad Prijs/kg Waarde\n"); 13 printf("Vergistbaar ingredient Voorraad Prijs/kg Waarde\n");
14 printf("---------------------------------------- ---------- -------- --------\n"); 14 printf("------------------------------------------------------------ ---------- -------- --------\n");
15 while($row = $result->fetch_array(MYSQLI_ASSOC)) { 15 while($row = $result->fetch_array(MYSQLI_ASSOC)) {
16 $value = $row['inventory'] * $row['cost']; 16 $value = $row['inventory'] * $row['cost'];
17 $tot_fermentables += $value; 17 $tot_fermentables += $value;
18 // printf("%-40s %10.5f kg %8.2f %8.2f \n", $row['name'], $row['inventory'], $row['cost'], $value); 18 // printf("%-60s %10.5f kg %8.2f %8.2f \n", $row['name'], $row['inventory'], $row['cost'], $value);
19 } 19 }
20 printf("---------------------------------------- --------\n"); 20 printf(" --------\n");
21 printf("Totaal %8.2f\n\n", $tot_fermentables); 21 printf("Totaal %8.2f\n\n", $tot_fermentables);
22 22
23 $tot_hops = 0.0; 23 $tot_hops = 0.0;
24 $result = $mysqli->query("SELECT name,inventory,cost FROM inventory_hops WHERE inventory > 0"); 24 $result = $mysqli->query("SELECT name,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 0");
25 $tot_fermentables = 0.0; 25 printf("Hoppen Voorraad Prijs/kg Waarde\n");
26 printf("Hoppen Voorraad Prijs/kg Waarde\n"); 26 printf("------------------------------------------------------------ ---------- -------- --------\n");
27 printf("---------------------------------------- ---------- -------- --------\n");
28 while($row = $result->fetch_array(MYSQLI_ASSOC)) { 27 while($row = $result->fetch_array(MYSQLI_ASSOC)) {
29 $value = $row['inventory'] * $row['cost']; 28 $value = $row['inventory'] * $row['cost'];
30 $tot_hops += $value; 29 $tot_hops += $value;
31 printf("%-40s %10.5f kg %8.2f %8.2f \n", $row['name'], $row['inventory'], $row['cost'], $value); 30 $hop = $row['form'] . " " . $row['origin'] . " - " . $row['name'];
31 $stock = floatval($row['inventory']) * 1000.0;
32 // printf("%-60s %10.1f gr %8.2f %8.2f \n", $hop, $stock, $row['cost'], $value);
32 } 33 }
33 printf("---------------------------------------- --------\n\n"); 34 printf(" --------\n");
34 printf("Totaal %8.2f\n", $tot_hops ); 35 printf("Totaal %8.2f\n\n", $tot_hops );
35 36
36 $tot_yeats = 0.0; 37 $tot_yeasts = 0.0;
37 $result = $mysqli->query("SELECT name,inventory,cost FROM inventory_yeasts WHERE inventory > 0"); 38 $result = $mysqli->query("SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0");
38 $tot_fermentables = 0.0; 39 printf("Gisten Voorraad Prijs/kg Waarde\n");
39 printf("Hoppen Voorraad Prijs/kg Waarde\n"); 40 printf("------------------------------------------------------------ ---------- -------- --------\n");
40 printf("---------------------------------------- ---------- -------- --------\n"); 41 while($row = $result->fetch_array(MYSQLI_ASSOC)) {
42 $value = $row['inventory'] * $row['cost'];
43 $yeast = $row['laboratory'] . " " .$row['product_id'] . " - " . $row['name'];
44 $tot_yeasts += $value;
45 $stock = floatval($row['inventory']) * 1000.0;
46 ($row['form'] == 'Dry') ? $amount = "gr" : $amount = "ml";
47 // printf("%-60s %10.1f %s %8.2f %8.2f \n", $yeast, $stock, $amount, $row['cost'], $value);
48 }
49 printf(" --------\n");
50 printf("Totaal %8.2f\n\n", $tot_yeasts );
51
52 $tot_miscs = 0.0;
53 $result = $mysqli->query("SELECT name,type,amount_is_weight,inventory,cost FROM inventory_miscs WHERE inventory > 0");
54 printf("Diverse ingredienten Voorraad Prijs/kg Waarde\n");
55 printf("------------------------------------------------------------ ---------- -------- --------\n");
41 while($row = $result->fetch_array(MYSQLI_ASSOC)) { 56 while($row = $result->fetch_array(MYSQLI_ASSOC)) {
42 $value = $row['inventory'] * $row['cost']; 57 $value = $row['inventory'] * $row['cost'];
43 $tot_yeasts += $value; 58 $misc = $row['type'] . " " . $row['name'];
44 printf("%-40s %10.5f kg %8.2f %8.2f \n", $row['name'], $row['inventory'], $row['cost'], $value); 59 $tot_miscs += $value;
60 $stock = floatval($row['inventory']) * 1000.0;
61 ($row['amount_is_weight']) ? $amount = "gr" : $amount = "ml";
62 printf("%-60s %10.1f %s %8.2f %8.2f \n", $misc, $stock, $amount, $row['cost'], $value);
45 } 63 }
46 printf("---------------------------------------- --------\n\n"); 64 printf(" --------\n");
47 printf("Totaal %8.2f\n", $tot_yeasts ); 65 printf("Totaal %8.2f\n\n", $tot_miscs );
48 ?> 66 ?>
49 </pre> 67 </pre>
50 </div> 68 </div>
51 69
52 <?php 70 <?php

mercurial