<?
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");
date_default_timezone_set("Asia/Calcutta"); 
$jvno=$_REQUEST['jvno'];
$br=$_REQUEST['br'];
$div=$_REQUEST['div'];
if($div=='PSNEICHER')
{
    $sql="delete FROM psnindia_gen4psnauto_psn_psneicherdb.journal2 where jvno = $jvno and brcode = '$br' ";
    $result = mysqli_query($db,$sql);
    $date = date("Y-m-d H:i:s");
    $sql="insert into psnindia_gen4psnauto_psn_psneicherdb.log (brcode,user,ip,date,action) values ('$br','$user','','$date','Delete JVNo:$jvno from PSN HO')";
    $result = mysqli_query($db,$sql);    
}
if($div=='ZF')
{
    $sql="delete FROM psnindia_gen4psnauto_psn_zfdb.journal2 where jvno = $jvno and brcode = '$br' ";
    $result = mysqli_query($db,$sql);
    $date = date("Y-m-d H:i:s");
    $sql="insert into psnindia_gen4psnauto_psn_zfdb.log (brcode,user,ip,date,action) values ('$br','$user','','$date','Delete JVNo:$jvno from PSN HO')";
    $result = mysqli_query($db,$sql);    
}
if($div=='BOSCH')
{
    $sql="delete FROM psnindia_gen4psnauto_psn_accessoriesdb2526.journal2 where jvno = $jvno and brcode = '$br' ";
    $result = mysqli_query($db,$sql);
    $date = date("Y-m-d H:i:s");
    $sql="insert into psnindia_gen4psnauto_psn_accessoriesdb2526.log (brcode,user,ip,date,action) values ('$br','$user','','$date','Delete JVNo:$jvno from PSN HO')";
    $result = mysqli_query($db,$sql);    
}
print "<script> alert(' Bank Receipt Rejected .....');</script>";
print "<font color=green>Data Deleted....</font><br><script>document.location='../br_othdiv.php'</script>";
?>