<?
session_start();
include("../opendb.php");
include("../test.php");
if($submit)
{
 if($pswd=='del')
  {
 $sql="delete from salesreturn where brcode='$brcode' and retno='$retno' and jvno='$jvno'";
 mysqli_query($db,$sql) or die(mysqli_error($db));
 $sql="delete from journal2 where brcode='$brcode' and tr_no='$retno' and jvno='$jvno'";
 mysqli_query($db,$sql) or die(mysqli_error($db));
log_entry($brcode,$user,$REMOTE_ADDR,"Del sales return retno:$retno, Journal: $jvno");
 print "<script> alert('Sales return has been cancelled'); document.location='saleretrepo.php'</script>";
}
else
{
 print "<script> alert('Invalid Password');document.location='delreturnspare.php'</script>";
}
}
?>
<link rel="stylesheet" href="../style.css" type="text/css" />
<style>
//	tr{background-color:white}
	th{background-color:steelblue;color:white}
td{font-size:12}
.right{text-align:right};
</style>
<center>
<form action='<?print $PHP_SELF?>' method='post'>
<table bgcolor=red><tr><td align=center><font color=white><b>
DELETE SALES RETURN</TD></TR>
<TR><TD ALIGN=CENTER BGCOLOR=WHITE>
<input type=hidden name='retno' value='<?print $retno?>'>
<input type=hidden name='jvno' value='<?print $jvno?>'>

<table>
<tr><td>Enter Password </td><td><input type=password name='pswd'></td></tr>
<tr><td colspan=2 align=center BGCOLOR='ORANGE'><input type=submit value='Submit' name='submit'>
<input type=button value='Cancel' onClick=document.location='saleretrepo.php'></td></tr>
</table>
</form>
</TD></TR>
</TABLE>

