<?
session_start();
?>

<style>
body{background-color:silver}
select,input,td{font-family:verdana;font-size:12}
</style>

<?
if($ps!='clt')
{
 print "<script> alert('Invalid Password'); history.back(2); </script>";
 return;
}

include("opendb.php");
include("test.php");

$result=mysqli_query($db,"select * from actrans where code='$code' and brcode='$brcode'")or die(mysqli_error());
$row=mysqli_fetch_array($result)or die(mysqli_error());

if(mysqli_num_rows($result)<=0)
 {
   print "Record does not exist";
   return;
 }
?>
<center>
<b>CURRENT TRANSACTION
<table>
<tr><td>Date</td><td><input type=text name=dt value='<?print datetohtml($row[dt])?>'></td></tr>
<tr><td>Dr</td><td><input type=text name=dr value='<?print $row[dr]?>'></td></tr>
<tr><td>Cr</td><td><input type=text name=cr value='<?print $row[cr]?>'></td></tr>
<tr><td>Amount</td><td><input type=text name=amt value='<?print $row[amt]?>'style={text-align:right}></td></tr>

</table>
<HR>
<FONT COLOR=BROWN><b>ENTER NEW TRANSACTION
<table border=0 cellspacing=4 cellpadding=4 bgcolor=red>
<tr><td bgcolor=silver>

<form action='edittrans3.php'>
<table>
<input type=hidden name=code value='<?print $code?>'>
<tr><td>Voucher</td><td><input type=text name=vouch value='<?print $row[vouch]?>'></td></tr>

<tr><td>Date </td><td><input type=text name=dt value='<?print datetohtml($row[dt])?>'>(date,month,year)</td></tr>
<tr><td>Dr</td><td>
<select name='dr'>
<?
 print "<option>$row[dr]</option>";
$res=mysqli_query($db,"select led from ledger where brcode='$brcode' order by led");
while($ledrow=mysqli_fetch_row($res))
{
 print "<option>$ledrow[0]</option>";
}
?>
</select>
</td></tr>
<tr><td>Cr</td><td>
<select name='cr'>
<?
 print "<option>$row[cr]</option>";
$res=mysqli_query($db,"select led from ledger where brcode='$brcode' order by led");
while($ledrow=mysqli_fetch_row($res))
{
 print "<option>$ledrow[0]</option>";
}
?>
</select>
</td></tr>
<tr><td>Amount</td><td><input type=text name=amt value='<?print $row[amt]?>'style={text-align:right}></td></tr>
<tr><td> Narration </td><td> <textarea name=narr><?print $row[narr]?></textarea></td></tr>
<tr><td colspan=2><center><input type=submit value='Update Entry'> <input type=Button value='Cancel' onClick=document.location='db1.php'>
</table>

</form>
</td></tr>
</table>


