<?
session_start();
include("../opendb.php");
include("../test.php");
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 pur_no='$pno' and brcode='$brcode'")or die (mysqli_error());
mysqli_query($db,"delete from vehopstock where dano='$da' and brcode='$brcode' and optype='-'")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='NULL' 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,$REMOTE_ADDR,"Del Veh purchase-$da");
print "<font color=red>Record has been deleted</font";
include("veh_purch.php");
?>
