<?
session_start();
include("../opendb.php");
include("../test.php");
$brcode = $_SESSION['brcode'];
$user = $_SESSION['user'];
$da = $_REQUEST['da'];
$pno = $_REQUEST['pno'];
$pur = $_REQUEST['pur'];
$jvno = $_REQUEST['jvno'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}
mysqli_query($db,"delete from veh_purchase where da='$da' and jvno ='$jvno' and brcode='$brcode'")or die (mysqli_error());

mysqli_query($db,"delete from veh_movement where da='$da' and brcode='$brcode' and type='pur'") or die(mysqli_error());

$sq="update purorder set purno='-',purdate='0000-00-00' where dano='$da' and brcode='$brcode'";
mysqli_query($db,$sq) or die(mysqli_error());

$sq="delete from journal2 where jvno='$jvno' and brcode='$brcode'";
mysqli_query($db,$sq) or die(mysqli_error());

log_entry($brcode,$user,"$jvno|Veh purchase|Del","Del Veh purchase-$da",$db);
print "<font color=red>Record has been deleted</font";
include("veh_purch.php");
?>
