<?
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;
}

?>
<input type=button value='Find Duplicate A/C Head' onClick=window.open('getdupcust.php')>
<br>&nbsp;
	<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";
 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' action='svcustomer.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>CUSTOMER 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>Customer Name</td><td><input type=text name='cname' size=40 onCopy='return true' onDrag='return false' onDrop='return false' onPaste='return true' autocomplete='off'   onKeyDown=chkey(this);></td></tr>

<tr><td>TCS Applicable</td><td><select name='corp'><option>No</option><option>Yes</option>
<?
/*$re=mysqli_query($db,"select * from corp_master where branch='$brcode'  order by corpname");
while($row=mysqli_fetch_row($re))
{
 print "<option>$row[1]</option>";
}*/
?>
</select>
</td></tr>


<tr bgColor='c1d7bb'><td><font color=red>Display Name<br><font color=blue>(A/c Head) 
</td><td><input type=text name='acname' size=40 onCopy='return true' onDrag='return false' onDrop='return false' onPaste='return true' 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 false' onDrop='return false' onPaste='return true' 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><input type=text name='state1' size=40 value='Kerala'></td></tr>
<tr><td>pin</td><td><input type=text name='pin1' size=6></td></tr>
<tr><td>Phone</td><td><input type=text name='phone1' size=40></td></tr>

<tr><td colspan=2 align=center bgcolor='lightsteelblue'>PRESENT</td></tr>
<tr><td>Address</td><td><input type=text name='addr2' size=40></td></tr>
<tr><td>District</td><td><input type=text name='dist2' size=40></td></tr>
<tr><td>State</td><td><input type=text name='state2' size=40 value='Kerala'></td></tr>
<tr><td>pin</td><td><input type=text name='pin2' size=6></td></tr>
<tr><td>Phone</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>
<select name='relation'>
<option>S/o</option>
<option>D/o</option>
<option>W/o</option>
</select>

 </td><td><input type=text name='father' 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>Web</td><td><input type=text name='web' size=40></td></tr>

<tr><td colspan=2>TIN <input type=text name='tin' size=10>
GST <input type=text name='cst' size=10>
PAN <input type=text name='kgst' size=10></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>A/C Name<th>Address <th>Dist <th>State <th> Pin <th>Phone <th>Mobile <th>Cramt<th>Crdays<th>Del
<?
$re=mysqli_query($db,"select * from customer where brcode='$brcode' order by acname")or die(mysqli_error($db));
$i=1;
while($row=mysqli_fetch_array($re))
{
    print "\n<form method='post' action='editcust.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[acname]</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><td>\n<input type=submit value='Edit' name='edit'></td></tr></form>";
}
?>
</table>


