forked from codepoetIn/POSNIC-1.02
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_supplier.php
256 lines (190 loc) · 7.73 KB
/
add_supplier.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
<?php
include_once("init.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>POSNIC - Add Supplier</title>
<!-- Stylesheets -->
<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet'>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="js/date_pic/date_input.css">
<link rel="stylesheet" href="lib/auto/css/jquery.autocomplete.css">
<!-- Optimize for mobile devices -->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<!-- jQuery & JS files -->
<?php include_once("tpl/common_js.php"); ?>
<script src="js/script.js"></script>
<script src="js/date_pic/jquery.date_input.js"></script>
<script src="lib/auto/js/jquery.autocomplete.js "></script>
<script src="js/script.js"></script>
<script>
/*$.validator.setDefaults({
submitHandler: function() { alert("submitted!"); }
});*/
$(document).ready(function() {
// validate signup form on keyup and submit
$("#form1").validate({
rules: {
name: {
required: true,
minlength: 3,
maxlength: 200
},
address: {
minlength: 3,
maxlength: 500
},
contact1: {
minlength: 3,
maxlength: 20
},
contact2: {
minlength: 3,
maxlength: 20
}
},
messages: {
name: {
required: "Please enter a supplier Name",
minlength: "Supplier must consist of at least 3 characters"
},
address: {
minlength: "Supplier Address must be at least 3 characters long",
maxlength: "Supplier Address must be at least 3 characters long"
}
}
});
});
</script>
</head>
<body>
<!-- TOP BAR -->
<?php include_once("tpl/top_bar.php"); ?>
<!-- end top-bar -->
<!-- HEADER -->
<div id="header-with-tabs">
<div class="page-full-width cf">
<ul id="tabs" class="fl">
<li><a href="dashboard.php" class="dashboard-tab">Dashboard</a></li>
<li><a href="view_sales.php" class=" sales-tab">Sales</a></li>
<li><a href="view_customers.php" class="customers-tab">Customers</a></li>
<li><a href="view_purchase.php" class="purchase-tab">Purchase</a></li>
<li><a href="view_supplier.php" class="active-tab supplier-tab">Supplier</a></li>
<li><a href="view_product.php" class="stock-tab">Stocks / Products</a></li>
<li><a href="view_payments.php" class="payment-tab">Payments / Outstandings</a></li>
<li><a href="view_report.php" class="report-tab">Reports</a></li>
</ul> <!-- end tabs -->
<!-- Change this image to your own company's logo -->
<!-- The logo will automatically be resized to 30px height. -->
<a href="#" id="company-branding-small" class="fr"><img src="<?php if(isset($_SESSION['logo'])) { echo "upload/".$_SESSION['logo'];}else{ echo "upload/posnic.png"; } ?>" alt="Point of Sale" /></a>
</div> <!-- end full-width -->
</div> <!-- end header -->
<!-- MAIN CONTENT -->
<div id="content">
<div class="page-full-width cf">
<div class="side-menu fl">
<h3>supplier Management</h3>
<ul>
<li><a href="add_supplier.php">Add Supplier</a></li>
<li><a href="view_supplier.php">View Supplier</a></li>
</ul>
</div> <!-- end side-menu -->
<div class="side-content fr">
<div class="content-module">
<div class="content-module-heading cf">
<h3 class="fl">Add supplier</h3>
<span class="fr expand-collapse-text">Click to collapse</span>
<span class="fr expand-collapse-text initial-expand">Click to expand</span>
</div> <!-- end content-module-heading -->
<div class="content-module-main cf">
<?php
//Gump is libarary for Validatoin
if(isset($_POST['name'])){
$_POST = $gump->sanitize($_POST);
$gump->validation_rules(array(
'name' => 'required|max_len,100|min_len,3',
'address' => 'max_len,200',
'contact1' => 'alpha_numeric|max_len,20',
'contact2' => 'alpha_numeric|max_len,20'
));
$gump->filter_rules(array(
'name' => 'trim|sanitize_string|mysql_escape',
'address' => 'trim|sanitize_string|mysql_escape',
'contact1' => 'trim|sanitize_string|mysql_escape',
'contact2' => 'trim|sanitize_string|mysql_escape'
));
$validated_data = $gump->run($_POST);
$name = "";
$address = "";
$contact1 = "";
$contact2 = "";
if($validated_data === false) {
echo $gump->get_readable_errors(true);
} else {
$name=mysql_real_escape_string($_POST['name']);
$address=mysql_real_escape_string($_POST['address']);
$contact1=mysql_real_escape_string($_POST['contact1']);
$contact2=mysql_real_escape_string($_POST['contact2']);
$count = $db->countOf("supplier_details", "supplier_name='$name'");
if($count==1)
{
echo "<font color=red> Dublicat Entry. Please Verify</font>";
}
else
{
if($db->query("insert into supplier_details values(NULL,'$name','$address','$contact1','$contact2',0)"))
echo "<br><font color=green size=+1 > [ $name ] Supplier Details Added !</font>" ;
else
echo "<br><font color=red size=+1 >Problem in Adding !</font>" ;
}
}
}
?>
<form name="form1" method="post" id="form1" action="">
<p><strong>Add Supplier Details </strong> - Add New ( Control +u)</p>
<table class="form" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span class="man">*</span>Name:</td>
<td><input name="name"placeholder="ENTER YOUR FULL NAME" type="text" id="name" maxlength="200" class="round default-width-input" value="<?php echo $name; ?>" /></td>
<td>Contact 1 </td>
<td><input name="contact1" placeholder="ENTER YOUR ADDRESS contact1"type="text" id="buyingrate" maxlength="20" class="round default-width-input"
value="<?php echo $contact1; ?>" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Address</td>
<td><textarea name="address" placeholder="ENTER YOUR ADDRESS"cols="8" class="round full-width-textarea"><?php echo $address; ?></textarea></td>
<td>Contact 2 </td>
<td><input name="contact2"placeholder="ENTER YOUR contact2" type="text" id="sellingrate" maxlength="20" class="round default-width-input"
value="<?php echo $contact2; ?>" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
</td>
<td>
<input class="button round blue image-right ic-add text-upper" type="submit" name="Submit" value="Add">
(Control + S)
<td align="right"><input class="button round red text-upper" type="reset" name="Reset" value="Reset"> </td>
</tr>
</table>
</form>
</div> <!-- end content-module-main -->
</div> <!-- end content-module -->
</div> <!-- end full-width -->
</div> <!-- end content -->
<!-- FOOTER -->
<div id="footer">
<p>Any Queries email to <a href="mailto:[email protected]?subject=Stock%20Management%20System">[email protected]</a>.</p>
</div> <!-- end footer -->
</body>
</html>