<?
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
include("opendb.php");
$ledg=$_REQUEST['ledg'];
$result=mysqli_query($db,"select * from ledger where led='$ledg' and brcode='$brcode'");
$row=mysqli_fetch_array($result);
if(($user=='mathew')||($user=='sreejith')||($user=='minoshh')||($user=='latheef')||($user=='vibin')||($user=='antony')||($user=='thomas')||($user=='minosh')||($user=='shameem'))
{
?>
<style>
td,input,body{font-family:verdana}
</style>

<body bgcolor=silver>
<center>
<form name=f1 action='updledger.php' method='post'>
<?
if($ledg == "Cash" || $ledg == "Petty Cash")
{
print "<font color=red>(Update opening balance only)";
?>
<table border=1>
<TR><TD COLSPAN=2 BGCOLOR=#5b5858 ALIGN=CENTER><FONT COLOR=WHITE><B>EDIT LEDGER
</TD></TR>
<input type=hidden name=led value='<?print $row[0]?>'>
<tr><td>Ledger</td><td><?print $row[0]?></td></tr>
<tr><td>Group</td><td><input type=text readonly name=grp size=40 value='<?print $row[1]?>'> 
</td></tr>
<tr><td>Opening Balance</td><td><input type=text name=opb value='<?print $row[2]?>' style={text-align:right}></td></tr>
<tr><td>Debit/Credit</td><td>
<input type=text name=drcr readonly size=4 value='<?print $row[drcr]?>' style={background:silver}>

<TR><TD COLSPAN=2 BGCOLOR=#5b5858 ALIGN=CENTER>
 <INPUT TYPE=SUBMIT VALUE='SAVE'> <INPUT TYPE=BUTTON VALUE='CANCEL' onClick=history.back(1)>
</TD></TR>
</table>
<?
}
else
{
?>
<table border=1>
<TR><TD COLSPAN=2 BGCOLOR=#5b5858 ALIGN=CENTER><FONT COLOR=WHITE><B>EDIT LEDGER
</TD></TR>
<input type=hidden name=led value='<?print $row[0]?>'>
<tr><td>Ledger</td><td><?print $row[0]?></td></tr>
<tr><td>Group</td><td><input type=text readonly name=grp size=40 value='<?print $row[1]?>'> <input type=button value='?' onClick=window.open('getgrp.php',menubar=false,resizeable=false);></td></tr>
<tr><td>Opening Balance</td><td><input type=text name=opb value='<?print $row[2]?>' style={text-align:right}></td></tr>
<tr><td>Debit/Credit</td><td>
<input type=text name=drcr readonly size=4 value='<?print $row['drcr']?>' style={background:silver}>

<TR><TD COLSPAN=2 BGCOLOR=#5b5858 ALIGN=CENTER>
 <INPUT TYPE=SUBMIT VALUE='SAVE'> <INPUT TYPE=BUTTON VALUE='CANCEL' onClick=history.back(1)>
</TD></TR>
</table>
<?
}
?>
</form>
<?
}
?>
