<?
include_once('includes/top.php');
include_once('opendb.php');
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
//$br=$_SESSION['branch'];
if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='inde.php' </script>";
  return;
}
?>
<head>
<script>
function chkey(abc)
{
 yy=abc.value
 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>

</head>
<?
include_once("test.php");
if(isset($_POST['add']))
{
   	$prcunit=$_REQUEST['prcunit'];
   	$addr1=$_REQUEST['addr1'];
   	$phone1=$_REQUEST['phone1'];
   	$bnkname=$_REQUEST['bnkname'];
   	$bnkbr=$_REQUEST['bnkbr'];
   	$bnkacno=$_REQUEST['bnkacno'];
   	$bnkifsc=$_REQUEST['bnkifsc'];
   	$pin=$_REQUEST['pin'];
 	if(strlen($prcunit)<=0)
 	{
  		print "In sufficient entry"; 
  		return;
 	}
 	$re=mysqli_query($db,"select * from prcsunit where unitname='$prcunit' and brcode='$brcode'");
 	if(mysqli_num_rows($re)>0)
 	{
  		print "Duplicate entry $agrp";
  		return;
 	}
 	else
 	{
  		mysqli_query($db,"insert into prcsunit(unitname,brcode,addrs,phno,bnknm,bnkbrnch,bnkacntno,bnkifsc,pinno) values('$prcunit','$brcode','$addr1','$phone1','$bnkname','$bnkbr','$bnkacno','$bnkifsc','$pin')");
 	}
}
if(isset($_POST['del']))
{
	$prcunit=$_REQUEST['prcunit'];
	mysqli_query($db,"delete from prcsunit where unitname='$prcunit'");
}
?>
<title>Demo</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="scripts/jquery-latest.js"></script>
<link type="text/css" href="includes/style1.css" rel="stylesheet" />
<link type="text/css" href="css/form.css" rel="stylesheet" />
<script type="text/javascript">
        $(function() {
          if ($.browser.msie && $.browser.version.substr(0,1)<7)
          {
			$('li').has('ul').mouseover(function(){
				$(this).children('ul').show();
				}).mouseout(function(){
				$(this).children('ul').hide();
				})
          }
        });        
    </script>
<script>
function valid()
{
}
</script>

<script type="text/javascript">

/***********************************************
* Disable "Enter" key in Form script- By Nurul Fadilah(nurul@REMOVETHISvolmedia.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
                
function handleEnter (field, event) {
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		} 
		else
		return true;
	}      

</script>
<style>
#txt{
font-family: Arial, Helvetica;
background-color: #F2F2F2;

}
table.form {
    font-weight: normal;
   
}
</style>
<style>
th{background-color:steelblue;color:white}
</style>
<body background="back_ground.jpg">
<?php //include('logo2.php'); ?>
<form name='f1' action='<?print $PHP_SELF?>' onSubmit="return valid()" method='post'> 


<table class="container"><tr><td>
<font style="font-family: 'Trebuchet MS',Verdana,Helvetica,sans-serif; font-size:15px;">  &nbsp;&nbsp;Master >> Processing Unit</font>


<center>
<table class="form" ><tr><th colspan='2'>
<h3><font color='black'>Processing Unit</font></h3></td></tr>
<form action='<?print $PHP_SELF?>'>

<tr><td>Unit Name </td><td><input type=text name='prcunit' size=40 onKeyUp=chkey(this) onKeyPress="return handleEnter(this, event)"></td></tr>
<tr ><td>Address </td><td><input type=text name='addr1' size=40 onKeyPress='return handleEnter(this, event)'></td></tr>
<tr ><td>Pin No </td><td><input type=text name='pin' size=40 onKeyPress='return handleEnter(this, event)'></td></tr>
<tr ><td>Phone </td><td><input type=text name='phone1' size=40 onKeyPress='return handleEnter(this, event)'></td></tr>

<tr ><td>Bank Name</td><td><input type=text name='bnkname' size=40 onKeyPress='return handleEnter(this, event)'></td></tr>
<tr ><td>Branch</td><td><input type=text name='bnkbr' size=40 onKeyPress='return handleEnter(this, event)'></td></tr>
<tr ><td>Account No</td><td><input type=text name='bnkacno' size=40 onKeyPress='return handleEnter(this, event)'></td></tr>
<tr ><td>IFS Code</td><td><input type=text name='bnkifsc' size=40 onKeyPress='return handleEnter(this, event)'></td></tr>

<tr> <th colspan='2' align='center'><input type=submit value='Add' name='add'></th></tr>
</table>
</form>
<br>
<table border=1 class='report' width='50%'>
<th>SlNO<th>Unit Name<th>Address<th>Phone<th>Bank Name<th>Account No<th>Action
<?
$i=1;
$res=mysqli_query($db,"select * from prcsunit where brcode='$brcode' order by unitname ");
 while($row=mysqli_fetch_array($res))
 {
 print "<tr><form action='$PHP_SELF'><input type=hidden name='prcunit' value='$row[0]'><td>".$i++."</td><td>$row[0]</td><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td><td>$row[7]</td><td><input type=submit value='Del' name='del'></td></form></tr>";
  }
?>
