forked from PintLabs/PHP-Brewerydb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinventory.php
More file actions
172 lines (155 loc) · 4.55 KB
/
Copy pathinventory.php
File metadata and controls
172 lines (155 loc) · 4.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
include 'include.php';
include 'header.php';
$action = $_POST['action'];
echo "<table align='center' width='80%'>
<tr>
<td><form name=\"inventory\" action='inventory.php' method=\"post\">
<input type=\"hidden\" name=\"action\" value=\"List\" />
<input type=\"submit\" value=\"List All\" />
</form>
</td>
<td><form name=\"inventory\" action='inventory.php' method=\"post\">
<input type=\"hidden\" name=\"action\" value=\"new_stock\" />
<input type=\"submit\" value=\"Add Stock\" />
</form>
</td>
<td><form name=\"inventory\" action='inventory.php' method=\"post\">
<input type=\"hidden\" name=\"action\" value=\"add_to\" />
<input type=\"submit\" value=\"Restock\" />
</form>
</td>
<td><form name=\"inventory\" action='inventory.php' method=\"post\">
<input type=\"hidden\" name=\"action\" value=\"sub_from\" />
<input type=\"submit\" value=\"De-Stock\" />
</form>
</td>
<td><form name=\"inventory\" action='inventory.php' method=\"post\">
<input type=\"hidden\" name=\"action\" value=\"set_to\" />
<input type=\"submit\" value=\"Set Qty.\" />
</form>
</td>
<td><form name=\"inventory\" action='inventory.php' method=\"post\">
<input type=\"hidden\" name=\"action\" value=\"fix_values\" />
<input type=\"submit\" value=\"Change data\" />
</form>
</td>
<td><form name=\"inventory\" action='inventory.php' method=\"post\">
<input type=\"hidden\" name=\"action\" value=\"refresh_all\" />
<input type=\"submit\" value=\"Refresh All Data\" />
</form>
</td>
</tr>
</table>";
// Uncomment if you want inventory to always be displayed.
//showInventory3();
switch ($action)
{
case "List":
showInventory3();
break;
case "new_stock":
echo '<br /><br />';
echo '<form action="inventory.php" method="post">';
echo 'UPC: <input type="text" name="upc"> ';
echo 'ID: <input type="text" name="id"> ';
echo 'QTY: <input type="text" name="qty">';
echo '<input type="hidden" name="action" value="new_stock">';
echo '<input type="submit">';
echo '</form>';
if(isset($_POST['upc']) || isset($_POST['id']))
{
if(setInventory($_POST['upc'], $_POST['id'], 1, $_POST['qty']))
{
fetchDetails($_POST['upc']);
unset($_POST['action']);
}
}
break;
case "add_to":
echo '<br /><br />';
echo '<form action="inventory.php" method="post">';
echo 'UPC: <input type="text" name="upc">';
echo 'New Qty.: <input type="text" name="qty">';
echo '<input type="hidden" name="action" value="add_to">';
echo '<input type="submit" value="Add">';
echo '</form>';
if(isset($_POST['upc']))
{
if(addInventory($_POST['upc'], $_POST['qty']))
{
unset($_POST['action']);
}
}
break;
case "sub_from":
echo '<br /><br />';
echo '<form action="inventory.php" method="post">';
echo 'UPC: <input type="text" name="upc">';
echo 'New Qty.: <input type="text" name="qty">';
echo '<input type="hidden" name="action" value="sub_from">';
echo '<input type="submit" value="Subtract">';
echo '</form>';
if(isset($_POST['upc']))
{
if(minusInventory($_POST['upc'], $_POST['qty']))
{
unset($_POST['action']);
}
}
break;
case "set_to":
echo '<br /><br />';
echo '<form action="inventory.php" method="post">';
echo 'UPC: <input type="text" name="upc">';
echo 'New Qty.: <input type="text" name="qty">';
echo '<input type="hidden" name="action" value="set_to">';
echo '<input type="submit" value="Set">';
echo '</form>';
if(isset($_POST['upc']))
{
if(setQty($_POST['upc'], $_POST['qty']))
{
unset($_POST['action']);
}
}
break;
case "fix_values":
echo '<br /><br />';
echo '<form action="inventory.php" method="post">';
echo 'UPC: <input type="text" name="upc">';
echo 'ID: <input type="text" name="id">';
echo 'QTY: <input type="text" name="qty">';
echo '<input type="hidden" name="action" value="fix_values">';
echo '<input type="submit">';
echo '</form>';
if(isset($_POST['upc']))
{
unset($_POST['action']);
if(updateInventoryValues($_POST))
{
unset($_POST['action']);
}
}
break;
case "refresh_all":
echo '<br /><br />';
echo '<form action="inventory.php" method="post">';
echo '<input type="hidden" name="action" value="refresh_all">';
echo '<input type="hidden" name="confirm" value="yes">';
echo '<input type="submit" Value="Are You Sure?">';
echo '</form>';
if(isset($_POST['confirm']))
{
unset($_POST['action']);
if(reloadAllDetails())
{
unset($_POST['action']);
}
}
break;
default:
break;
}
include 'footer.php';
?>