<?
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];

if(strlen($brcode)<=0)
{
  print "<script> alert('Invalid User'); parent.document.location='ind.php' </script>";
  return;
}
include("../opendb.php");
include("../test.php");
?>
<title>Xpress</title>
   <script src="../rightclick_deactive.js"></script>
    <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">

<?php include('top.php'); ?>
<table class="container"><tr><td>
<font style="font-family: 'Trebuchet MS',Verdana,Helvetica,sans-serif; color:white;">  &nbsp;&nbsp;Accounts >> Ledger Reconciliation</font>
<?
if($print)
{
$df=$y.'-'.$m.'-'.$d;
$dto=$y1.'-'.$m1.'-'.$d1;
print "<script> window.open('prnledreco.php?df=$df&dto=$dto&bnk=$bnk'); </script>";
return;
}
if($show||$df)
{
if(!$df)
{
$df=$y.'-'.$m.'-'.$d;
$dto=$y1.'-'.$m1.'-'.$d1;
}
 $res=mysqli_query($db,"select * from journal2 where partic='$bnk' and brcode='$brcode' and date>='$df' and date<='$dto' order by date")or die(mysqli_error($db));

print "<center><table cellspacing=1 cellpadding=3 class='report'><th colspan=7>LEDGER RECONCILITATION OF <br>$bnk <br>From ".datetohtml($df).' to '.datetohtml($dto)."<tr>";
print "<th>No. <th>Date <th>Narration<th>Amount<th> Date<th>Update";
$i=1;
while($drow=mysqli_fetch_array($res))
{
 print "\n<tr >";
 print "\n<form action='updbreco.php' method='post'>";
 print "\n<input type=hidden name='jvno' value='$drow[jvno]'>";
 print "\n<input type=hidden name='bdate' value='$drow[date]'>";
 print "\n<input type=hidden name='bank' value='$bnk'>";
 print "\n<input type=hidden name='df' value='$df'>";
 print "\n<input type=hidden name='dto' value='$dto'>";
 print "\n<td>".$i++."</td><td>".datetohtml($drow[date])."</td><td>$drow[narr]<br>Against: $drow[against]: $drow[no]</td>";
 print "<td align=right>".putComa($drow[dramt]+$drow[cramt])."</td>";
 print "<td width=125>";
 $sq="select recdate from breco where jvno='$drow[jvno]' and bank='$bnk' and brcode='$brcode'";
$recres=mysqli_query($db,$sq);
 $recdt=mysqli_fetch_array($recres);
  $spdate=explode('-',$recdt[0]);

?>
d <input type=text name=rd size=1 value='<?print $spdate[2]?>'>
m <input type=text name=rm size=1 value='<?print $spdate[1]?>'>
y <input type=text name=ry  value='<?print $spdate[0]?>' size=3></td>
<td><input type=submit value='Upd' name='upd'></td>
</form>
</tr>
<?
}

return;
}// end if show

?>
<form action='<?print $PHP_SELF?>'>
<?
print "<center><table class='form'><tr bgcolor='green'> <th colspan=5> <font color='white'>Ledger RECONCILIATION</font></th></tr>";
print "<tr><td>Ledger </td><td><select name='bnk'>";
$bre=mysqli_query($db,"select * from ledger where brcode='$brcode' order by led")or die('err'.mysqli_error($db));
while($row=mysqli_fetch_array($bre))
{
 print "<option>$row[led]</option>";
}
?>
</select></td></tr>
<tr><td>From</td><td>
<input type=text name=d value='<?print date('d')?>' size=1>
<input type=text name=m value='<?print date('m')?>' size=1>
<input type=text name=y value='<?print date('Y')?>' size=3>
</td></tr>
<tr><td>To</td><td>

<input type=text name=d1 value='<?print date('d')?>' size=1>
<input type=text name=m1 value='<?print date('m')?>' size=1>
<input type=text name=y1 value='<?print date('Y')?>' size=3>
</td></tr>
<tr><th colspan=2 align=center><input type=submit value="Show" name='show'>
<input type=submit value="Print" name='print'>
</td></tr>
</form>
</td></tr></table>

