<?
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;
}
$code=$_REQUEST['code'];
if(($user=='mathew')||($user=='sreejith')||($user=='minosh'))
{
?>
<style>
body{font-family:verdana;font-size:14}
</style>
<body bgcolor=ivory>
<center>
<p>&nbsp;<p>&nbsp;<p>&nbsp;
<h3><blink><font color=red> WARNING!</FONT></BLINK></H3>
<?
include("opendb.php");
$result=mysqli_query($db,"select led from ledger where led='$code' and brcode='$brcode'")or die(mysqli_error());

$ledrow=mysqli_fetch_row($result)or die(mysqli_error());
$sql="select * from journal2 where partic='$ledrow[0]' and brcode='$brcode'";

$transresult=mysqli_query($db,$sql);
print "<font color=BLACK>There are <font color=RED>".mysqli_num_rows($transresult)." <font color=BLACK>transactions under the ledger <b>".$ledrow[0];
?>
<body onload=document.f1.pswd.focus()>
<br><br>
Please enter password to delete the Transaction and Ledger
<form name=f1 action='deltrans.php'>
<input type=hidden name=led value='<?print $ledrow[0]?>'>
<input type=hidden name=ledcode value='<?print $code?>'>

<table bgcolor=RED cellspacing=2 cellpadding=1 width=400>
<tr><td>
<table bgcolor=yellow width=100%>
<tr bgcolor=yellow><td>Password</td><td><input type=password name=pswd></td></tr>
<tr bgcolor=yellow><td colspan=2><center><input type=submit value='Delete Transaction and Ledger' style={font-size:19}></td></tr>
</table>
</td></tr>
</table>
<?
}
?>