<?
session_start();
if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='ind.php' </script>";
  return;
}
?>

<style>
 td{font-family:verdana;font-size:12;color:black;}
 th{font-family:verdana;font-size:14;color:white;background-color:#5b5858}
 body{background-color:silver;}
 select
  {border-style:ridge;
   border-color:black;
   height:25px;
   border-size=1;
   font-family:verdana;
   color:black;
  }
 input
  {border-style:ridge;
   border-color:#22437f;
   background-color:white;
   height:25px;
   font-weight:bold;
   border-size=1;
   font-family:sans-serif;
   color:BLACK;
  }
 textarea
  {border-style:ridge;
   border-color:#22437f;
   background-color:white;
//   height:25px;
//   font-weight:bold;
   border-size=1;
   font-family:sans-serif;
   color:BLACK;
  }
</style>
<head>
<script type="text/javascript">
function checkLen(x,y)
{
if(isNaN(y))
 {
   alert('Invalid Entry');
    return false;
 }
if (y.length==x.maxLength)
	{
	var next=x.tabIndex
	if (next<document.getElementById("myForm").length)
		{
		document.getElementById("myForm").elements[next].focus()
		}
	}
}
</script>
</head>
<?
include("opendb.php");
$re=mysqli_query($db,"select max(dt) from actrans");
$row=mysqli_fetch_row($re);
$date=explode('-',$row[0]);

?>

<body onload=document.f1.vouch.focus()>
<center>
<form name=f1 id='myForm' action="svpay.php" method=post>
<table width=600>
<tr><td colspan=4 bgcolor=#5b5858 align=center><font color=white size=3><B>VOUCHER ENTRY</font></tr></td>
<tr>
  <td>Voucher No.</td><td><input type=text tabindex='1' name=vouch size=10></td>
  <td>Date</td><td>dd <input type=text tabindex='2' maxlength='2' size=1 name=d value='<?print $date[2]?>'>
  mm <input type=text size=1 name=m tabindex='3' maxlength='2' value='<?print $date[1]?>'> 
  yyyy <input type=text size=3 name=y tabindex='4' maxlength='4' value='<?print $date[0]?>'>
  </td>
</tr>
<tr><td>Dr.</td><td>
<select name=ledg>
<?
 $result=mysqli_query($db,"select * from ledger where brcode='$brcode' and led !='Cash' order by led");
 while($row=mysqli_fetch_row($result))
 {
  print "<option>$row[0]</option>";
 }
?>
</select>
</td> <td>Amount</td><td><input type=text name=amt style={text-align:right} size=22></td></tr>
<tr>
  <td>Mode</td><td><select name=mode>
<option>Cash</option>
<option>Petty Cash</option>

<?
 $result=mysqli_query($db,"select * from ledger where grp='Bank Accounts' and brcode='$brcode' order by led");
 while($row=mysqli_fetch_row($result))
 {
  print "<option>$row[0]</option>";
 }
?>

</select></td>
  <td>Narration </td><td><textarea name=narr></textarea></td>
</tr>
<tr><td colspan=4 bgcolor=#5b5858 align=center>
<input type=submit value="Save"> <input type=reset value='Cancel'>
</td></tr>
</table>
</form>


