<?
session_start();
include_once('opendb.php');
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
$ledg=$supname=$_REQUEST['ledg'];

$result=mysqli_query($db,"select * from ledger where led='$ledg' ");

//$result=mysqli_query($db,"select * from ledger where led='$ledg' and (brcode='$brcode' )");

//print $r=("select * from ledger where led='$ledg' and (brcode='$brcode' )");


$row=mysqli_fetch_array($result)or die('Leger '.$ledg.' does not belong to this branch'.mysqli_error($db));
//print $row[0];
?>
<title>Online Shopping & Inventory Management System</title>
    <script type="text/javascript" src="scripts/jquery-latest.js"></script>
	<link type="text/css" href="includes/style1.css" rel="stylesheet" />
	<link type="text/css" href="css/form.css" rel="stylesheet" />
    <script type="text/javascript">
        $(function() {
          if ($.browser.msie && $.browser.version.substr(0,1)<7)
          {
			$('li').has('ul').mouseover(function(){
				$(this).children('ul').show();
				}).mouseout(function(){
				$(this).children('ul').hide();
				})
          }
        });        
    </script>
<body background="back_ground.jpg">

<style>
td,input,body{font-family:verdana}
</style>

<center>
<form name=f1 action='updledgerall.php' method='post'>
<?
if($ledg == "Cash" || $ledg == "CASH IN HAND")
{
print "<font color=red>(Update opening balance only)";
?>
<table border=1>
<TR><TD COLSPAN=4 BGCOLOR=#5b5858 ALIGN=CENTER><FONT COLOR=WHITE><B>EDIT LEDGER
</TD></TR>
<input type=hidden name=led value='<? echo $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>
<?
if($brcode=='13793'||$brcode=='13770'||$brcode=='13771'||$brcode=='13774'||$brcode=='13775'||$brcode=='13776'||$brcode=='13777'||$brcode=='13779'||$brcode=='13780'||$brcode=='13781'||$brcode=='13796'||$brcode=='13786'||$brcode=='13789'||$brcode=='13783'||$brcode=='13795'||$brcode=='13799'||$brcode=='13772'||$brcode=='137731')
{
    ?>
    
<tr><td>Opening Balance</td><td><input type=text readonly name=opb value='0' style={text-align:right}></td></tr>
<?
}
    else
    {
        
?>
<tr><td>Opening Balance</td><td><input type=text  name=opb value='0' 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}></td></tr>

<tr><td>Code</td><td>
<input type=text name=code readonly size=10 value='<?print $row['code']?>' style={background:silver}></td></tr>

<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
{
//echo $row[0];
?>
<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><? echo $row[0] ?> </td></td></tr>
<tr><td>Group</td><td><input type=text readonly name=grp size=40 value='<? echo $row[1]?>'> </td></tr>
<tr><td>Opening Balance</td><td><input type=text name=opb value='0' 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}></td></tr>
<tr><td>Code</td><td>
<input type=text name=code readonly size=10 value='<?print $row['code']?>' style={background:silver}></td></tr>

<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>
