<? 
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}

include("opendb.php");
include("test.php");

$del=$_REQUEST['del'];
$pswd=$_REQUEST['pswd'];
$crno=$_REQUEST['crno'];
$jvno=$_REQUEST['jvno'];
if($del)
{
 if($pswd=='delch')
 {
   $sql="delete from veh_trans where invno='$crno'  and brcode='$brcode'";
   print $sql;
   mysqli_query($db,$sql)  or die(mysqli_error($db));
   $ip_address = "$jvno|Delivery Note|Del";
   log_entry($brcode,$user,$ip_address,"delivery Note Delete JVNo: $jvno, Cr No: $crno",$db);
   print "<script> alert('Delivery note has been deleted'); document.location='veh_trans.php'; </script>";
  }
  else
   print "<script> alert('Invalid Password');</script>";
}
?>
<style>
body,td{font-family:'arial narrow';letter-spacing:1;font-size:13}
th{background-color:c1d799}
</style>

<center>
<form action='<?print $PHP_SELF?>'>
<input type=hidden name='crno' value='<?print $crno?>'>
<input type=hidden name='jvno' value='<?print $jvno?>'>

<table bgcolor=red>
<tr><td><B><font color=white><center>DELETE Delivery NOTE</td></tr>
<tr><td bgcolor=white>
<table>
<tr><td>
Password</td><td><input type=password name='pswd'></td>
<td><input type=submit value='Delete' name='del'></td></tr>
</table>
</td></tr>
</table>
</form>
