forked from vishaloshnif/stock-management-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_category.php
executable file
·316 lines (277 loc) · 10.6 KB
/
add_category.php
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<?php
session_start(); // Use session variable on this page. This function must put on the top of page.
if(!isset($_SESSION['username']) || $_SESSION['usertype'] !='admin'){ // if session variable "username" does not exist.
header("location:index.php?msg=Please%20login%20to%20access%20admin%20area%20!"); // Re-direct to index.php
}
else
{
include_once "db.php";
error_reporting (E_ALL ^ E_NOTICE);
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Welcome to Stock Management System !</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css" media="screen" title="no title" charset="utf-8" />
<link rel="stylesheet" href="css/template.css" type="text/css" media="screen" title="no title" charset="utf-8" />
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/jquery.validationEngine-en.js" type="text/javascript"></script>
<script src="js/jquery.validationEngine.js" type="text/javascript"></script>
<script src="js/jquery.hotkeys-0.7.9.js"></script>
<!-- AJAX SUCCESS TEST FONCTION
<script>function callSuccessFunction(){alert("success executed")}
function callFailFunction(){alert("fail executed")}
</script>
-->
<script>
$(document).ready(function() {
// SUCCESS AJAX CALL, replace "success: false," by: success : function() { callSuccessFunction() },
$("#category").focus();
$("#form1").validationEngine(),
jQuery(document).bind('keydown', 'Ctrl+s',function() {
$('#form1').submit();
return false;
});
jQuery(document).bind('keydown', 'Ctrl+r',function() {
$('#form1').reset();
return false;
});
jQuery(document).bind('keydown', 'Ctrl+a',function() {
window.location = "add_category.php";
return false;
});
jQuery(document).bind('keydown', 'Ctrl+0',function() {
window.location = "admin.php";
return false;
});
jQuery(document).bind('keydown', 'Ctrl+1',function() {
window.location = "add_purchase.php";
return false;
});
jQuery(document).bind('keydown', 'Ctrl+2',function() {
window.location = "add_stock_sales.php";
return false;
});
jQuery(document).bind('keydown', 'Ctrl+3',function() {
window.location = "add_stock_details.php";
return false;
});
jQuery(document).bind('keydown', 'Ctrl+4',function() {
window.location = "add_category.php";
return false;
});
jQuery(document).bind('keydown', 'Ctrl+5',function() {
window.location = "add_supplier_details.php";
return false;
});
jQuery(document).bind('keydown', 'Ctrl+6',function() {
window.location = "add_customer_details.php";
return false;
});
jQuery(document).bind('keydown', 'Ctrl+7',function() {
window.location = "view_stock_entries.php";
return false;
});
jQuery(document).bind('keydown', 'Ctrl+8',function() {
window.location = "view_stock_sales.php";
return false;
});
jQuery(document).bind('keydown', 'Ctrl+9',function() {
window.location = "view_stock_details.php";
return false;
});
//$.validationEngine.loadValidation("#date")
//alert($("#formID").validationEngine({returnIsValid:true}))
//$.validationEngine.buildPrompt("#date","This is an example","error") // Exterior prompt build example // input prompt close example
//$.validationEngine.closePrompt(".formError",true) // CLOSE ALL OPEN PROMPTS
});
</script>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #FFFFFF;
}
*{
padding: 0px;
margin: 0px;
}
#vertmenu {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 100%;
width: 160px;
padding: 0px;
margin: 0px;
}
#vertmenu h1 {
display: block;
background-color:#FF9900;
font-size: 90%;
padding: 3px 0 5px 3px;
border: 1px solid #000000;
color: #333333;
margin: 0px;
width:159px;
}
#vertmenu ul {
list-style: none;
margin: 0px;
padding: 0px;
border: none;
}
#vertmenu ul li {
margin: 0px;
padding: 0px;
}
#vertmenu ul li a {
font-size: 80%;
display: block;
border-bottom: 1px dashed #C39C4E;
padding: 5px 0px 2px 4px;
text-decoration: none;
color: #666666;
width:160px;
}
#vertmenu ul li a:hover, #vertmenu ul li a:focus {
color: #000000;
background-color: #eeeeee;
}
.style1 {color: #000000}
-->
</style>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top"><table width="960" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="960" border="0" cellpadding="0" cellspacing="0" bgcolor="#ECECEC">
<tr>
<td height="90" align="left" valign="top"><img src="images/topbanner.jpg" width="960" height="82"></td>
</tr>
<tr>
<td height="800" align="left" valign="top"><table width="960" border="0" cellpadding="0" cellspacing="0" bgcolor="#ECECEC">
<tr>
<td width="130" align="left" valign="top">
<br>
<strong>Welcome <font color="#3399FF"><?php echo $_SESSION['username']; ?> !</font></strong><br> <br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><a href="admin.php"><img src="images/home.png" width="130" height="99" border="0"></a></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"><a href="add_purchase.php"><img src="images/purchase.png" width="130" height="124" border="0"></a></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"><a href="add_stock_sales.php"><img src="images/sales.png" width="146" height="111" border="0"></a></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"><a href="report.php"><img src="images/reports.png" width="131" height="142" border="0"></a></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"> </td>
</tr>
</table>
</td> <td height="500" align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="add_stock_details.php"><img src="images/addstockdetails.png" width="67" height="62" border="0"></a></td>
<td><a href="add_supplier_details.php"><img src="images/supplier.png" width="67" height="54" border="0"></a></td>
<td><a href="add_customer_details.php"><img src="images/customer.png" width="67" height="54" border="0"></a></td>
<td><a href="add_category.php"><img src="images/categories.png" width="67" height="54" border="0"></a></td>
<td><a href="view_stock_sales.php"><img src="images/vsales.png" width="67" height="54" border="0"></a></td>
<td><a href="view_stock_entries.php"><img src="images/vpurchase.png" width="67" height="54" border="0"></a></td>
<td><a href="view_stock_details.php"><img src="images/stockdetails.png" width="67" height="54" border="0"></a></td>
<td><a href="view_stock_availability.php"><img src="images/savail.png" width="67" height="54" border="0"></a></td>
<td align="left" valign="top"><a href="view_customer_details.php"><img src="images/customers.png" width="94" height="22" border="0"></a><br> <a href="view_supplier_details.php"><img src="images/suppliers.png" width="94" height="22" border="0"></a><br>
<a href="view_payments.php"><img src="images/payments.png" width="94" height="22" border="0"></a></td>
<td align="left" valign="top"><a href="view_stock_sales_payments.php"><img src="images/outstanding.png" width="94" height="22" border="0"></a><br> <a href="view_stock_entries_payments.php"><img src="images/pendings.png" width="94" height="22" border="0"></a><br>
<a href="logout.php"><img src="images/logout.png" width="94" height="22" border="0"></a></td>
</tr>
</table>
<?php
if(isset($_POST['category']))
{
$category=mysql_real_escape_string($_POST['category']);
$count = $db->countOf("category_details", "category_name='$category'");
if($count==1)
{
echo "<font color=red> Dublicat Entry. Please Verify</font>";
}
else
{
if($db->query("insert into category_details(category_name,category_description) values('$category','')"))
echo "<br><font color=green size=+1 >[ $category ] Category Added !</font>" ;
else
echo "<br><font color=red size=+1 >Problem in Adding !</font>" ;
}
}
?>
<br>
<br>
<form name="form1" method="post" id="form1" action="">
<p align="center"><strong>Add New Category </strong> </p>
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150"> </td>
<td width="150"> </td>
<td width="150"> </td>
</tr>
<tr>
<td width="150"> </td>
<td width="150"> </td>
<td width="150"> </td>
</tr>
<tr>
<td width="150">Category</td>
<td width="150"><input name="category" type="text" id="category" class="validate[required,length[0,100]] text-input" ></td>
<td width="150"><input type="submit" name="Submit" value="Add"></td>
</tr>
<tr>
<td width="150"> </td>
<td width="150"> </td>
<td width="150"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</form></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="30" align="center" bgcolor="#72C9F4" ><span class="style1"><a href="http://www.Oshnif.com" style="color:#FFF; font-weight:bolder">Developed by Oshnif Technologies Pvt .Ltd </a></span></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<?php
}
?>