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

//print $ledg;
$result=mysqli_query($db,"select * from ledger where led='$ledg' and (brcode='$brcode' )");
$row=mysqli_fetch_array($result)or die('Ledger '.$ledg.' does not belong to this branch'.mysqli_error($db));
//print $row[0];
?>
<title>AMPL EICHER</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='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='<? 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>
<tr><td>Opening Balance</td><td><input type=text readonly 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
{
//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] ?> <input type=button value='?' onClick=window.open('edledna.php',menubar=false,resizeable=false);></td></td></tr>
<tr><td>Group</td><td><input type=text readonly name=grp size=40 value='<? echo $row[1]?>'> <input type=button value='?' onClick=window.open('getgrp.php',menubar=false,resizeable=false);></td></tr>

<?
if($brcode=='3770'||$brcode=='3771'||$brcode=='3772'||$brcode=='3773'||$brcode=='3774'||$brcode=='3775'||$brcode=='3776'||$brcode=='3777'||$brcode=='3779'||$brcode=='3780'
||$brcode=='3781'||$brcode=='3783'||$brcode=='3785'||$brcode=='3786'||$brcode=='3787'||$brcode=='3788'||$brcode=='3789'||$brcode=='3790'||$brcode=='3791'||$brcode=='3792'
||$brcode=='3793'||$brcode=='3794'||$brcode=='3795'||$brcode=='3796'||$brcode=='3797'||$brcode=='3798'||$brcode=='3799'||$brcode=='377055'||$brcode=='377020'||$brcode=='3779'
||$brcode=='3779201'||$brcode=='3800'||$brcode=='3801'||$brcode=='3802'||$brcode=='3803'||$brcode=='3804'||$brcode=='3805'||$brcode=='3806'||$brcode=='3807'||$brcode=='3808'
||$brcode=='3809'||$brcode=='3810'||$brcode=='3811'||$brcode=='3812'||$brcode=='3999')
{
    
     
   if($user=='sunith' ||$user=='abhinand1'||$user=='SUNITH'||$user=='joy1')
{
    ?>
    
<tr><td>Opening Balance</td><td><input type=text name=opb   value='<? echo $row[2]?>' style={text-align:right}></td></tr>
<?
}
else
{
print "<tr><td>Opening Balance</td><td><input type=text name=opb  readonly value='$row[2]' style={text-align:right}></td></tr>"    ;
}
?>

<?
}
    else
    {
        
?>
<tr><td>Opening Balance</td><td><input type=text  name=opb value='<? echo $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>
