<?
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("../../test.php");
include("../../opendb.php");
  $y=$_REQUEST['y'];
    $m=$_REQUEST['m'];
      $d=$_REQUEST['d'];
      $y1=$_REQUEST['y1'];
    $m1=$_REQUEST['m1'];
      $d1=$_REQUEST['d1'];
      $df=$_REQUEST['fromdt'];
      $todt=$_REQUEST['todt'];
//$df=$y."-".$m."-".$d;
//$dt=$y1."-".$m1."-".$d1;
$bank=$_REQUEST['bank'];
$fromdate=$df;
$todate=$dt;
//echo $fromdate;
?>

<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" />
<link href="css/printline.css" type="text/css" rel="stylesheet" media="print,screen"  />

<table width=100%" border="0" cellspacing="0" cellpadding="0" class="grid" >
<center>
<font face=arial narrow size=3>
<?print $branch?><br>
<?
$res=mysqli_query($db,"select braddr from branch where brcode = '$brcode'");
$r1=mysqli_fetch_row($res);
//$fromdate=$fromdt;
$todate=$todt;
?>
<?print $r1[0]?><br>

Cheque Book Register ( <? print $bank ?> ) from <? print datetohtml($fromdate).' to '.datetohtml($todate)?>
</center>
<tr bgcolor='silver'><td><center><b>Entry Date</td><td><center><b>Payee</td><td><center><b>Cheque No.</td><td><center><b>Cheque Date</td><td><b>Amount<td><b>Narration</td></tr>
<?
  	
$re=mysqli_query($db,"select * from chq_det where brcode ='$brcode' and bank = '$bank' and chq_dt >= '$fromdate' and chq_dt <= '$todate' and status = 'BP' order by chq_dt") or die(mysqli_error());
$ss="select * from chq_det where brcode ='$brcode' and bank = '$bank' and chq_dt >= '$fromdate' and chq_dt <= '$todate' and status = 'BP' order by chq_dt";
//echo $ss;
while($row=mysqli_fetch_row($re))
{
	$re1=mysqli_query($db,"select narr from journal2 where partic = '$bank' and brcode = '$brcode' and jvno = $row[6]") or die(mysqli_error());
	//$ssq="select narr from journal2 where partic = '$bank' and brcode = '$brcode' and jvno = $row[6]";
	//echo $ssq;
	$row1=mysqli_fetch_row($re1);
	$entry_date1 = strtotime($row[2]);
	$entry_date = date('d-m-Y H:i',$entry_date1);
	$chq_date1 = strtotime($row[11]);
	$chq_date = date('d-m-Y',$chq_date1);
	print "<tr bgcolor='white'><td><center>".$entry_date."</td><td>".$row[1]."</td><td><center>".$row[0]."</td><td><center>".$chq_date."</td><td align=right>".$row[3]."<td>".$row1[0]."</td></tr>";
}
?>

