<?
session_start();

include_once('includes/top.php');
include_once('opendb.php');
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
$level=$_SESSION['level'];
if(strlen($user)<=0)
{
 print "<script> alert('You are not logged in') </script>";
 include("logout.php");
 return;
}
?>
	<link type="text/css" href="includes/style1.css" rel="stylesheet" />
<link href="css/form.css" type="text/css" rel="stylesheet" media="screen" />
<script>
function valid()
{ 
 subOK="false";
 
if(document.f1.state1.selectedIndex<1)
  {subOK="false"; alert('Invalid state');
      
    return false;  
  }




 x=confirm("Do you want to save?");
 if(x)
  subOK="true";
   if(subOK=="true")
     return true;
   else
     return false;
} 

function chkey(abc)
{
 yy=abc.value
 if(yy.length>35)
 { 
//   alert('Name exeeds the limit');
//   return;
 }

 if(yy.indexOf('  ')>-1) 
  {
    alert('Multiple space is not allowed');
    abc.value='';
  }
 if(yy.indexOf("'")>-1) 
  {
    alert("\' is not allowed");
    abc.value='';
  }
 if(yy.indexOf('"')>-1) 
  {
    alert("\" is not allowed");
    abc.value='';
  }

if(yy.indexOf("&")>-1) 
  {
    alert("& is not allowed");
    abc.value='';
  }

}
</script>

<?
/*
<center>
<form method='post'  name='f1' action='svparty.php' onSubmit="return valid()">
<table cellspacing=1 cellpadding=2 class='form'>
<tr height=21><td colspan=2 align=center bgcolor='steelblue'><FONT COLOR=IVORY><B>GST MASTER</td></tr>
<TR><TD>Creation Date </TD><TD>dd  <input type=text name=d readonly size=2 value='<?print date("d",time())?>'>
mm  <input type=text name=m size=2 value='<?print date("m",time())?>'>
yy  <input type=text name=y size=4 value='<?print date("Y",time())?>'>
</td></tr>
<tr><td>Party Name</td><td><input type=text name='cname' size=40  onDrag='return false' onDrop='return false'  autocomplete='off'   onKeyDown=chkey(this);></td></tr>




<tr bgColor='c1d7bb'><td>SAP CODE<br><font color=blue> 
</td><td><input type=text name='sapcode' size=40 onDrag='return true' onDrop='return false'  autocomplete='on' onKeyDown=chkey(this);></td></tr>

<tr><td colspan=2 align=center bgcolor='lightsteelblue'>PERMANANT</td></tr>
<tr><td>Address</td><td><input type=text name='addr1' size=40></td></tr>
<tr><td>District</td><td><input type=text name='dist1' size=40></td></tr>
<tr><td>State</td><td> <select name='state1' id=state1><option>Select State</option>
<option>Kerala</option><option>Tamil Nadu</option><option>Karnataka</option><option>Andhra Pradesh</option>
<option>Arunachal Pradesh</option><option>Assam</option><option>Bihar</option><option>Chandigarh</option><option>Chhattisgarh</option>
<option>Dadra and Nagar Haveli</option><option>Daman and Diu</option><option>Delhi</option><option>Goa</option>
<option>Gujarat</option><option>Haryana</option><option>Himachal Pradesh</option><option>Jammu and Kashmir</option>
<option>Jharkhand</option><option>Madhya Pradesh</option><option>Maharashtra</option><option>Manipur</option>
<option>Meghalaya</option><option>Mizoram</option><option>Nagaland</option><option>Orissa</option>
<option>Puducherry</option><option>Punjab</option><option>Rajasthan</option><option>Sikkim</option><option>Telangana</option>
<option>Tripura</option><option>Uttar Pradesh</option><option>Uttarakhand</option><option>West Bengal</option>
    </select></td></tr>
<tr><td>pin</td><td><input type=text name='pin1' size=6></td></tr>
<tr><td>Phone1</td><td><input type=text name='phone1' size=40></td></tr>
<tr><td>Phone2</td><td><input type=text name='phone2' size=40></td></tr>


<tr><td colspan=2 align=center bgcolor='lightsteelblue'>OTHER</td></tr>
<tr><td>Mobile</td><td><input type=text name='mob' size=40></td></tr>


<tr><td>Date of Birth</td>
<td>
 dd  <input type=text name='d1' size=2 value='0'>
mm  <input type=text name='m1' size=2 value='0'>
yy  <input type=text name='y1' size=4 value='0'>
</td></tr>

<tr><td>Email_id </td><td><input type=text name='email' size=40></td></tr>
<tr><td>PAN </td><td><input type=text name='kgst' size=15></td></tr>
<tr><td>
GST</td><td> <input type=text name='cst' size=20></td></tr>



<tr><td colspan=2 align=center bgcolor='lightsteelblue'>
<input type=submit value='Save' name='sv'> <input type=button value='Cancel'>
</td></tr>
</table>
</form>
*/?>

<table cellspacing=1 cellpadding=3 class='report'>
<th>No. <th>Name <th>PAN<th>GST<th>Address <th>Dist <th>State <th> Pin <th>Phone <th>Mobile <th>Del
<?
$re=mysqli_query($db,"select * from partymaster  order by cname")or die(mysqli_error($db));
$i=1;
while($row=mysqli_fetch_array($re))
{
// print "\n<form method='post' action='editparty.php'>\n<input type=hidden name='code' value='$row[1]'><input type=hidden name='acname' value='$row[5]'>";
 print "\n<tr bgcolor=aliceblue><td>".$i++."</td><td>$row[cname]</td><td>$row[pan]</td><td>$row[gst]</td><td>$row[addr1]</td><td>$row[dist1]</td><td>$row[state1]</td><td>$row[pin1]</td><td>$row[phone1]</td>";
 print "<td>$row[mob]</td><td>$row[cramt]</td><td>$row[crdays]</td>";
 if ($user=='sunith')
 {
  print"<td><input type=button value='Del' onClick=del('$row[gst]')></td></tr>";
    
 }
 else
 {
   print"</tr>";
  
 }
  //</form>
}
?>
</table>

<script>


function del(gstcode)
{
if(confirm("Do you want to delete GST "+gstcode+" ?"))
 document.location="delgstmas.php?gstcode="+gstcode;

}
</script>


