Skip to content

Commit 42069c1

Browse files
authored
Merge pull request #38 from xJMV/V0.1.0
V0 1 0
2 parents 80ce4e2 + 83b3515 commit 42069c1

File tree

10 files changed

+417
-7
lines changed

10 files changed

+417
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PrepInventory is the re-make of a personal project that aim to manage home inven
88

99
## Copyrights
1010
##### PrepInventory
11-
Jean-Michel Vien (xJMV - 2015) <[email protected]>
11+
Jean-Michel Vien (xJMV - 2015-2017) <[email protected]>
1212

1313
##### Web GUI
1414
Start Bootstrap was created by and is maintained by **David Miller**, Managing Partner at [Iron Summit Media Strategies](http://www.ironsummitmedia.com/).

pages/admin_invlog.php

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<?PHP
2+
session_start();
3+
include('xinc.config.php');
4+
5+
# Check if session exists.
6+
# If Session (UID) is not existing, redirect to login.php
7+
# Else show the page IF user is admin.
8+
if (empty($_SESSION['username'])) {
9+
header('location:login.php');
10+
die();
11+
}
12+
if ($_SESSION['role'] !== 'admin') {
13+
header('location:login.php');
14+
die();
15+
}
16+
?>
17+
18+
<!DOCTYPE html>
19+
<html lang="en">
20+
21+
<head>
22+
<meta charset="utf-8">
23+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
24+
<meta name="viewport" content="width=device-width, initial-scale=1">
25+
<meta name="description" content="">
26+
<meta name="author" content="">
27+
28+
<title>PrepInventory</title>
29+
30+
<!-- PrepInventory CSS -->
31+
<link href="../dist/css/PrepInventory.css" rel="stylesheet">
32+
33+
<!-- Bootstrap Core CSS -->
34+
<link href="../bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
35+
36+
<!-- MetisMenu CSS -->
37+
<link href="../bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">
38+
39+
<!-- Timeline CSS -->
40+
<link href="../dist/css/timeline.css" rel="stylesheet">
41+
42+
<!-- Custom CSS -->
43+
<link href="../dist/css/sb-admin-2.css" rel="stylesheet">
44+
45+
<!-- Morris Charts CSS -->
46+
<link href="../bower_components/morrisjs/morris.css" rel="stylesheet">
47+
48+
<!-- Custom Fonts -->
49+
<link href="../bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
50+
51+
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
52+
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
53+
<!--[if lt IE 9]>
54+
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
55+
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
56+
<![endif]-->
57+
58+
</head>
59+
60+
<body>
61+
62+
<div id="wrapper">
63+
64+
<!-- Navigation -->
65+
<?PHP include('xinc.nav.php'); ?>
66+
67+
<div id="page-wrapper">
68+
<div class="row">
69+
<div class="col-lg-12">
70+
<h1 class="page-header">Inventory Log</h1>
71+
</div>
72+
<!-- /.col-lg-12 -->
73+
</div>
74+
<!-- /.row -->
75+
<div class="row">
76+
<div class="col-lg-12">
77+
<table width="100%"><tr><th>Date & Time</th><th>Item</th><th>Location</th><th>Quantity</th><th>User</th></tr>
78+
<?PHP
79+
$sql = "SELECT * FROM `inv_log` ORDER BY `id` DESC LIMIT 0,99";
80+
$result = mysqli_query($link, $sql);
81+
if (mysqli_num_rows($result) < 1) { print '<tr><td colspan="5">No LOG available.</td></tr>'; }
82+
else {
83+
while($row = mysqli_fetch_assoc($result)) {
84+
$datetime = $row['datetime'];
85+
$user = $row['user'];
86+
$location = $row['location'];
87+
$qty = $row['qty'];
88+
$action = $row['action'];
89+
$item_id = $row['item'];
90+
$log_id = $row['id'];
91+
92+
# Load item name
93+
$sql2 = "SELECT * FROM `inv_items` WHERE `id` = '$item_id'";
94+
$result2 = mysqli_query($link, $sql2);
95+
if (mysqli_num_rows($result2) < 1) { $item_name = "Unknown Item"; }
96+
else {
97+
while($row2 = mysqli_fetch_assoc($result2)) {
98+
$item_name = $row2['name'];
99+
}
100+
}
101+
102+
# Load location
103+
if (!empty($location)) {
104+
$loc_lev = explode("-", $location)[0];
105+
$loc_id = explode("-", $location)[1];
106+
$sql2 = "SELECT * FROM `inv_locations_$loc_lev` WHERE `id` = '$loc_id'";
107+
$result2 = mysqli_query($link, $sql2);
108+
if (mysqli_num_rows($result2) > 0) {
109+
while($row2 = mysqli_fetch_assoc($result2)) {
110+
$loc_name = $row2['name'];
111+
}
112+
}
113+
}
114+
else { $loc_name = "Unknown Location"; }
115+
116+
print '<tr><td>'.$datetime.'</td><td>'.$item_name.'</td><td>'.$loc_name.'</td><td>'.$action.' '.$qty.'</td><td>'.$conf['user'][$user]['name'].'</td></tr>';
117+
}
118+
}
119+
?>
120+
</table>
121+
</div>
122+
<!-- /.col-lg-12 -->
123+
</div>
124+
<!-- /.row -->
125+
</div>
126+
<!-- /#page-wrapper -->
127+
128+
</div>
129+
<!-- /#wrapper -->
130+
131+
<!-- jQuery -->
132+
<script src="../bower_components/jquery/dist/jquery.min.js"></script>
133+
134+
<!-- Bootstrap Core JavaScript -->
135+
<script src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
136+
137+
<!-- Metis Menu Plugin JavaScript -->
138+
<script src="../bower_components/metisMenu/dist/metisMenu.min.js"></script>
139+
140+
<!-- Custom Theme JavaScript -->
141+
<script src="../dist/js/sb-admin-2.js"></script>
142+
143+
</body>
144+
145+
</html>
146+
147+
<?PHP include('xinc.foot.php'); ?>

pages/inventory_add.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
# Add a line to the inventory log
4141
$username = $_SESSION['username'];
42-
$sql = "INSERT INTO `inv_log` (`item`, `action`, `qty`, `user`) VALUES ('$item', '+', '$qty', '$username')";
42+
$sql = "INSERT INTO `inv_log` (`item`, `action`, `qty`, `user`, `location`) VALUES ('$item', '+', '$qty', '$username', '$location')";
4343
$result = mysqli_query($link, $sql);
4444
}
4545
else {

pages/inventory_details.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
while($row = mysqli_fetch_assoc($result)) {
2424
$t_qty = $row['qty'];
2525
$t_item = $row['item'];
26+
$t_location = $row['location'];
2627
}
2728

2829
# Set qty to 0 if nothing submited.
@@ -49,7 +50,7 @@
4950

5051
# Add a line to the inventory log
5152
$username = $_SESSION['username'];
52-
$sql = "INSERT INTO `inv_log` (`item`, `action`, `qty`, `user`) VALUES ('$t_item', '$inv_act', '$inv_qty', '$username')";
53+
$sql = "INSERT INTO `inv_log` (`item`, `action`, `qty`, `user`, `location`) VALUES ('$t_item', '$inv_act', '$inv_qty', '$username', '$t_location')";
5354
$result = mysqli_query($link, $sql);
5455
}
5556
}

pages/login.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
$username = $_POST['username'];
1515
if (!empty($conf['user'][$username]['password']) && $conf['user'][$username]['password'] == $_POST['password']) {
1616
$_SESSION['username'] = $_POST['username'];
17+
$_SESSION['role'] = $conf['user'][$username]['role'];
18+
$_SESSION['name'] = $conf['user'][$username]['name'];
1719
header('location:index.php');
1820
}
1921
else { $error = 1; }

pages/paperforms_maninvpickup_gen.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,21 @@
1010
die();
1111
}
1212

13-
if (!empty($_GET['loc'])) { $loc = $_GET['loc']; }
13+
if (!empty($_GET['loc'])) {
14+
$loc = $_GET['loc'];
15+
16+
# Load location
17+
$loc_lev = explode("-", $loc)[0];
18+
$loc_id = explode("-", $loc)[1];
19+
$sql2 = "SELECT * FROM `inv_locations_$loc_lev` WHERE `id` = '$loc_id'";
20+
$result2 = mysqli_query($link, $sql2);
21+
if (mysqli_num_rows($result2) > 0) {
22+
while($row2 = mysqli_fetch_assoc($result2)) {
23+
$loc_name = $row2['name'];
24+
}
25+
}
26+
else { $loc_name = "Unknown Location"; }
27+
}
1428
else { $loc = 0; }
1529
?>
1630

@@ -24,7 +38,7 @@
2438
<body>
2539
<div style="align: center;">
2640
<h1>PrepInventory</h1>
27-
<h3>### Location here ###</h3>
41+
<h3>Pick up list for <?PHP print $loc_name; ?></h3>
2842
</div>
2943

3044
<?php

pages/paperforms_maninvrev.php

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<?PHP
2+
session_start();
3+
include('xinc.config.php');
4+
5+
# Check if session exists.
6+
# If Session (UID) is not existing, redirect to login.php
7+
# Else show the page.
8+
if (empty($_SESSION['username'])) {
9+
header('location:login.php');
10+
die();
11+
}
12+
?>
13+
14+
<!DOCTYPE html>
15+
<html lang="en">
16+
17+
<head>
18+
<meta charset="utf-8">
19+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
20+
<meta name="viewport" content="width=device-width, initial-scale=1">
21+
<meta name="description" content="">
22+
<meta name="author" content="">
23+
24+
<title>PrepInventory</title>
25+
26+
<!-- PrepInventory CSS -->
27+
<link href="../dist/css/PrepInventory.css" rel="stylesheet">
28+
29+
<!-- Bootstrap Core CSS -->
30+
<link href="../bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
31+
32+
<!-- MetisMenu CSS -->
33+
<link href="../bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">
34+
35+
<!-- Timeline CSS -->
36+
<link href="../dist/css/timeline.css" rel="stylesheet">
37+
38+
<!-- Custom CSS -->
39+
<link href="../dist/css/sb-admin-2.css" rel="stylesheet">
40+
41+
<!-- Morris Charts CSS -->
42+
<link href="../bower_components/morrisjs/morris.css" rel="stylesheet">
43+
44+
<!-- Custom Fonts -->
45+
<link href="../bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
46+
47+
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
48+
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
49+
<!--[if lt IE 9]>
50+
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
51+
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
52+
<![endif]-->
53+
54+
</head>
55+
56+
<body>
57+
58+
<div id="wrapper">
59+
60+
<!-- Navigation -->
61+
<?PHP include('xinc.nav.php'); ?>
62+
63+
<div id="page-wrapper">
64+
<div class="row">
65+
<div class="col-lg-12">
66+
<h1 class="page-header">Paper Forms</h1>
67+
</div>
68+
<!-- /.col-lg-12 -->
69+
</div>
70+
<!-- /.row -->
71+
<div class="row">
72+
<div class="col-lg-12">
73+
<!-- CODE -->
74+
75+
<div class="panel panel-default">
76+
<div class="panel-heading">
77+
Manual Inventory Revision List
78+
</div>
79+
<!-- /.panel-heading -->
80+
<div class="panel-body">
81+
Select a location below to generate a manual pick list for this location.
82+
<hr>
83+
<?php
84+
$sql = "SELECT * FROM `inv_locations_1` ORDER BY `name` ASC";
85+
$result = mysqli_query($link, $sql);
86+
if (mysqli_num_rows($result) < 1) { print "No root locations has been configured yet."; }
87+
else {
88+
while($row = mysqli_fetch_assoc($result)) {
89+
print '<img src="'. $row['icon'] .'" class="icon"> ' . $row["name"] . ' <a href="paperforms_maninvrev_gen.php?loc=1-'. $row['id'] .'" target="_BLANK"><i class="fa fa-print fa-fw"></i></a><br>';
90+
$sql2 = "SELECT * FROM `inv_locations_2` WHERE parent = '". $row['id'] ."' ORDER BY `name` ASC";
91+
$result2 = mysqli_query($link, $sql2);
92+
if (mysqli_num_rows($result2) > 0) {
93+
while($row2 = mysqli_fetch_assoc($result2)) {
94+
print '&emsp; <img src="'. $row2['icon'] .'" class="icon"> ' . $row2["name"] . ' <a href="paperforms_maninvrev_gen.php?loc=2-'. $row2['id'] .'" target="_BLANK"><i class="fa fa-print fa-fw"></i></a><br>';
95+
$sql3 = "SELECT * FROM `inv_locations_3` WHERE parent = '". $row2['id'] ."' ORDER BY `name` ASC";
96+
$result3 = mysqli_query($link, $sql3);
97+
if (mysqli_num_rows($result3) > 0) {
98+
while($row3 = mysqli_fetch_assoc($result3)) {
99+
print '&emsp;&emsp; <img src="'. $row3['icon'] .'" class="icon"> ' . $row3["name"] . ' <a href="paperforms_maninvrev_gen.php?loc=3-'. $row3['id'] .'" target="_BLANK"><i class="fa fa-print fa-fw"></i></a><br>';
100+
$sql4 = "SELECT * FROM `inv_locations_4` WHERE parent = '". $row3['id'] ."' ORDER BY `name` ASC";
101+
$result4 = mysqli_query($link, $sql4);
102+
if (mysqli_num_rows($result4) > 0) {
103+
while($row4 = mysqli_fetch_assoc($result4)) {
104+
print '&emsp;&emsp;&emsp; <img src="'. $row4['icon'] .'" class="icon"> ' . $row4["name"] . ' <a href="paperforms_maninvrev_gen.php?loc=4-'. $row4['id'] .'" target="_BLANK"><i class="fa fa-print fa-fw"></i></a><br>';
105+
}
106+
}
107+
}
108+
}
109+
}
110+
}
111+
print '<br>';
112+
}
113+
}
114+
?>
115+
</div>
116+
<!-- /.panel-body -->
117+
</div>
118+
<!-- /.panel -->
119+
120+
<!-- /CODE -->
121+
</div>
122+
<!-- /.col-lg-12 -->
123+
</div>
124+
<!-- /.row -->
125+
</div>
126+
<!-- /#page-wrapper -->
127+
128+
</div>
129+
<!-- /#wrapper -->
130+
131+
<!-- jQuery -->
132+
<script src="../bower_components/jquery/dist/jquery.min.js"></script>
133+
134+
<!-- Bootstrap Core JavaScript -->
135+
<script src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
136+
137+
<!-- Metis Menu Plugin JavaScript -->
138+
<script src="../bower_components/metisMenu/dist/metisMenu.min.js"></script>
139+
140+
<!-- Custom Theme JavaScript -->
141+
<script src="../dist/js/sb-admin-2.js"></script>
142+
143+
</body>
144+
145+
</html>
146+
147+
<?PHP include('xinc.foot.php'); ?>

0 commit comments

Comments
 (0)