<?
session_start();
include_once("test.php");
include_once('opendb.php');
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
//$br=$_SESSION['branch'];
$led=$_REQUEST['led'];
$grp=$_REQUEST['grp'];
$op=$_REQUEST['op'];
$desc=$_REQUEST['desc'];
$dbno=$_REQUEST['dbno'];
$dt=$_REQUEST['dt'];

if(strlen($user)<=0)
{
  	print "<script> alert('Invalid User'); document.location='inde.php' </script>";
  	return;
}
$led=trim($led);
if(strlen($led)<=0 || strlen($grp)<=0 || strlen($op)<=0)
{
 	print "<script>alert('Insufficient Entry'); history.back(1);</script>";
 	return;
}
if(ereg("[&']",$led))
{
 	print "<script> alert('Please avoid & and \''); history.back(1);</script>";
 	return;
}
$code=substr($led,0,3).substr(time(),7,3);
$code=str_replace(' ','-',$code);
$led=str_replace('  ',' ',$led);



$sql="update dbnote set date='$dt',dramt='$op',partic='$grp',narr='$desc' where brcode='$brcode' and dbno='$dbno'";
//print $sql;
 //mysqli_query($db,$sql)or die(mysqli_error($db));



print "Debit not has been updated";
include("dbnote1.php");
?>
