<?
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_once("../test.php");
$bnk=$_REQUEST['bnk'];
?>
<style>
 /*td{font-family:arial narrow;font-size:14;color:black;}
 th{font-family:arial narrow;font-size:14;color:white;background-color:#5b5858}
 body{background-color:ivory;}
 select
  {border-style:ridge;
   border-color:black;
   height:25px;
   border-size=1;
   font-family:verdana;
   color:black;
  }
 input
  {border-style:ridge;
   border-color:#22437f;
   background-color:white;
   height:25px;
   font-weight:bold;
   border-size=1;
   font-family:sans-serif;
   color:BLACK;
  }*/
</style>

<script>
function show()
{
window.open("prnbbook.php?df=<?print$df?>&dt=<?print$dt?>&bnk=<?print $bnk?>");
}
</script>
<title>Khadi</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">

<?php include_once('top.php'); ?>
<?
$dfrom=$_REQUEST['dfrom'];
$dto=$_REQUEST['dto'];
$df=implode('-', array_reverse(explode('-',$dfrom)));
$dt=implode('-', array_reverse(explode('-',$dto)));
?>
<table class="container"><tr><td>
<center>
<br><br>
<font face=arial narrow size=4>
<?$dfrm=implode('-', array_reverse(explode('-', $df)));
$dto=implode('-', array_reverse(explode('-', $dt)));?>
Bank Report <font color=blue> <?print "</font><br>from  ".$dfrm." to ".$dto?>
<table  cellpadding=1 cellspacing=1 class='report'>
<tr ><th><center><b>Date</th> <th><center><b>Bank Name</th> <th><center><b>Amount </th><th><center><b>Narration</th>
<?
include_once("../opendb.php");
$mtot = 0;
$sq1=mysqli_query($db,"select * from journal2 where brcode='$brcode' and date >= '$df' and date <= '$dt' order by date");
while($row1=mysqli_fetch_array($sq1))
{
  $sq=mysqli_query($db,"select * from ledger where led ='$row1[partic]' and brcode = '$brcode'");
  $row=mysqli_fetch_array($sq);
  if($row[grp]=='Bank Accounts')
  {
    $dfrm=implode('-', array_reverse(explode('-', $row1[date])));
    if($row1[dramt]>0)
      print "<tr><td>".$dfrm."</td><td>".$row1[partic]."</td><td align='right'>".$row1[dramt]."</td><td>".$row1[narr]."</td></tr>";
    $mtot = $mtot + $row1[dramt];
//      else
//        print "<tr><td>".$dfrm."</td><td>".$row1[partic]."</td><td align='right'>".$row1[dramt]."</td><td>".$row1[narr]."</td></tr>";
  }
}
print "<tr><td colspan = 2 align='center'>T O T A L</td><td align='right'>".number_format($mtot,2,'.',',')."</td><td></td></tr>";
?>