-
Notifications
You must be signed in to change notification settings - Fork 0
/
supplier_popup.php
280 lines (244 loc) · 9.51 KB
/
supplier_popup.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
<?php
$PageTitle = "Add Supplier";
$myaction = isset($_REQUEST["myaction"])?strtolower(trim($_REQUEST["myaction"])):"";
$id = isset($_REQUEST["id"])?intval($_REQUEST["id"]):0;
$err = isset($_REQUEST["err"])?strtolower(trim($_REQUEST["err"])):"";
$errfld = isset($_REQUEST["errfld"])?$_REQUEST["errfld"]:"";
$sorton = isset($_REQUEST["sorton"])?$_REQUEST["sorton"]:"";
$sort = isset($_REQUEST["sort"])?$_REQUEST["sort"]:"";
$Keywords_Username = isset($_REQUEST["Keywords_Username"])?$_REQUEST["Keywords_Username"]:"";
if($myaction == "edit")
$PageTitle = "Update Member";
//include("../includes/admintop.php");
if ($myaction == "edit" && $id==0)
{
header ("Location: listsupplier.php");
exit;
}
$myTxtFlds = Array ("supp_name","supp_address", "supp_mo_no", "supp_phone_no", "supp_email", "supp_pan_no", "supp_bank_name", "supp_ac_no", "supp_rtgs", "supp_branch","product_ids","vat_no");
$myNumFlds = Array ();
$myVals = populateFields("Initialize",$myTxtFlds,$myNumFlds,"");
if (strlen($err) > 0 && $err != "none")
{
$myVals = populateFields("GPC",$myTxtFlds,$myNumFlds,"");
}
elseif ($myaction == "edit")
{
$qry = "SELECT * FROM tbl_supplier WHERE id=$id";
$result = mysql_query($qry) or die("can not select ec");
if (!($arow = mysql_fetch_array($result)))
{
header ("Location: error.php");
exit;
}
$myVals = populateFields("DB",$myTxtFlds,$myNumFlds,$arow);
mysql_free_result($result);
}
$mymsg = "";
if (strlen($err) > 0)
{
if ($err == "dup")
$mymsg = "Member <b>".$myVals["supp_email"]."</b> already exists.";
elseif ($err == "none")
$mymsg = "Details has been updated successfully.";
elseif ($err == "compulsory")
$mymsg = "$errfld can not be blank. Please enter $errfld.";
elseif ($err == "invalid")
$mymsg = "$errfld is invalid.";
elseif ($err == "cpass")
$mymsg = "Confirmed password does not match with password.";
elseif ($err == "mno1")
$mymsg = "$errfld size is not 10 number";
elseif ($err == "mno2")
$mymsg = "$errfld is not a number";
elseif ($err == "ac_no")
$mymsg = "A/c Number is not a number";
elseif ($err == "supp_rtgs")
$mymsg = "Rtgs Number is not a number";
if($mymsg != "")
echo "<center><span class='err'>$mymsg</span></center><br>";
}
?>
<?php /*?><script language="javascript">
function submitForm(frm)
{
CompulsoryTxtFlds = Array("supp_name","supp_address", "supp_mo_no", "supp_phone_no", "supp_email", "supp_pan_no", "supp_bank_name", "supp_ac_no", "supp_rtgs", "supp_branch");
FriendlyNames = Array("Supplier Name","Supplier Address", "Supplier Mobile Number", "Supplier Phone Number", "Supplier Email", "Supplier Pan Number", "Supplier Bank Name", "Supplier A/c No", "Supplier Rtgs", "Supplier Branch");
for(i=0;i<CompulsoryTxtFlds.length;i++)
{
myfld = eval("frm."+CompulsoryTxtFlds[i])
if(Trim(myfld.value) == "")
{
alert(FriendlyNames[i]+" can not be blank.");
myfld.focus();
return false;
}
}
var numbers = /^[0-9]+$/;
if(frm.supp_ac_no.value.match(numbers))
{
}
else{
alert('A/c is not a number.');
return false;
}
if(frm.supp_rtgs.value.match(numbers))
{
}
else{
alert('Rtgs is not a number.');
return false;
}
if(!validateEmail(frm.supp_email))
{
alert("Invalid Email.");
frm.supp_email.focus();
return false;
}
return true;
}
</script><?php */?><link href="../css/admincss.css" rel="stylesheet" type="text/css" />
<link href="../css/calendar-win2k-1.css" rel="stylesheet" type="text/css">
<form name="frm1" method="POST" action="supplier_popup_db.php" onsubmit="return submitForm(this);">
<br>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0" class="tblbg">
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr>
<td valign="top" align="left" class="tblheader" colspan="3">Details </td>
</tr>
<tr>
<td width="41%" class="tblrow">Supplier Name<font color="#FF0000"> *</font> </td>
<td width="5%" align="center" class="tblrow">:</td>
<td width="54%" class="tblrow">
<input name="supp_name" type="text" class="input" id="supp_name" value="<?php echo $myVals["supp_name"]?>" maxlength="100"> </td>
</tr>
<tr>
<td class="tblrow">Supplier Address<font color="#FF0000"> *</font> </td>
<td align="center" class="tblrow">:</td>
<td class="tblrow">
<input name="supp_address" type="text" class="input" id="supp_address" value="<?php echo $myVals["supp_address"]?>" maxlength="255"> </td>
</tr>
<tr>
<td class="tblrow">Supplier Mobile Number<font color="#FF0000"> *</font> </td>
<td align="center" class="tblrow">:</td>
<td class="tblrow">
<input name="supp_mo_no" type="text" class="input" id="supp_mo_no" value="<?php echo $myVals["supp_mo_no"]?>" maxlength="55">
<br /> Pls Enter Mobile Number like(9999999999,9999999999) </td>
</tr>
<tr>
<td class="tblrow">Supplier Phone Number<font color="#FF0000">*</font> </td>
<td align="center" class="tblrow">:</td>
<td class="tblrow">
<input name="supp_phone_no" type="text" class="input" id="supp_phone_no" value="<?php echo $myVals["supp_phone_no"]?>" maxlength="21"> </td>
</tr>
<tr>
<td class="tblrow">Supplier Email<font color="#FF0000"> *</font> </td>
<td align="center" class="tblrow">:</td>
<td class="tblrow">
<input name="supp_email" type="text" class="input" id="supp_email" value="<?php echo $myVals["supp_email"]?>" maxlength="100"> </td>
</tr>
<tr>
<td class="tblrow">Supplier Pan Number<font color="#FF0000"> *</font> </td>
<td align="center" class="tblrow">:</td>
<td class="tblrow">
<input name="supp_pan_no" type="text" class="input" id="supp_pan_no" value="<?php echo $myVals["supp_pan_no"]?>" maxlength="11">
</td>
</tr>
<tr>
<td valign="top" align="left" class="tblheader" colspan="3">Bank Details </td>
</tr>
<tr>
<td class="tblrow">Supplier Bank Name<font color="#FF0000"> *</font> </td>
<td align="center" class="tblrow">:</td>
<td class="tblrow">
<input name="supp_bank_name" type="text" class="input" id="supp_bank_name" value="<?php echo $myVals["supp_bank_name"]?>" maxlength="100">
</td>
</tr>
<tr>
<td class="tblrow">Supplier A/c Number<font color="#FF0000"> *</font> </td>
<td align="center" class="tblrow">:</td>
<td class="tblrow">
<input name="supp_ac_no" type="text" class="input" id="supp_ac_no" value="<?php echo $myVals["supp_ac_no"]?>" maxlength="20">
</td>
</tr>
<tr>
<td class="tblrow">Supplier Rtgs<font color="#FF0000"> *</font> </td>
<td align="center" class="tblrow">:</td>
<td class="tblrow">
<input name="supp_rtgs" type="text" class="input" id="supp_rtgs" value="<?php echo $myVals["supp_rtgs"]?>" maxlength="11">
</td>
</tr>
<tr>
<td class="tblrow">Supplier Branch<font color="#FF0000"> *</font> </td>
<td align="center" class="tblrow">:</td>
<td class="tblrow">
<input name="supp_branch" type="text" class="input" id="supp_branch" value="<?php echo $myVals["supp_branch"]?>" maxlength="100">
</td>
</tr>
<tr>
<td class="tblrow">Vat Number</td>
<td align="center" class="tblrow">:</td>
<td class="tblrow">
<input name="vat_no" type="text" class="input" id="vat_no" value="<?php echo $myVals["vat_no"]?>" maxlength="50"> </td>
</tr>
<tr>
<td valign="top" align="left" class="tblheader" colspan="3">Products </td>
</tr>
<tr>
<td valign="top" align="left" class="tblrow" colspan="3">
<?php
$pro_id_array="";
$sql="select * from tbl_product where Active='Yes'";
$qsql=mysql_query($sql);
$totpro=mysql_num_rows($qsql);
$i=0;
$ii=1;
if($totpro>0)
{?>
<table border="0" width="100%">
<tr>
<?php while($valproduct=mysql_fetch_array($qsql))
{
if($pro_id_array=="")
{
$pro_id_array=$valproduct['id'];
}
else
{
$pro_id_array=$pro_id_array.",".$valproduct['id'];
}
if($i%3==0)
{
echo "</tr><tr>";
}
?>
<td>
<?php echo $ii.". ".$valproduct['product_name']; ?></td>
<?php
$i++;
$ii++;
}?>
</tr>
</table>
<?php
}
?>
<input type="hidden" name="product_ids" value="<?php echo $pro_id_array; ?>" />
</td>
</tr>
<tr align="center">
<td colspan="3" class="tblrow"><input name="btn1" type="submit" value="Save" class="but"> <?php /*?><input name="btn12" type="button" value="Cancel" class="but" onclick="javascript: window.location='listcompany.php?sort=<?php echo $sort?>&sorton=<?php echo $sorton?>&Keywords_Username=<?php echo $Keywords_Username?>';"><?php */?></td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<input type="hidden" name="myaction" value="<?php echo $myaction?>">
<input type="hidden" name="id" value="<?php echo $id?>">
</form>
<?php
include('../includes/adminbottom.php');
?>