<?
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'];
$fromdt=$_REQUEST['fromdt'];
$bank=$_REQUEST['bank'];
$todt=$_REQUEST['todt'];      
$df=$y."-".$m."-".$d;
$dt=$y1."-".$m1."-".$d1;
?>

<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</tr>
<?
$re=mysqli_query($db,"select * from chq_bnk_for where brcode = '$brcode' and bank = '$bank'") or die(mysqli_error());
$row=mysqli_fetch_row($re);
$mformat = '../paypdf/can'.$row[1].'?jvno=';

$re=mysqli_query($db,"select * from chq_det where brcode ='$brcode' and bank = '$bank' and chq_dt >= '$fromdate' and chq_dt <= '$todate' order by chq_dt") or die(mysqli_error());
while($row=mysqli_fetch_row($re))
{
	print "\n<tr bgcolor='#fffcd6' onMouseOver=bgColor='#f7dbd4'; onMouseOut=bgColor='#fffcd6'>";
	print "<td><a href=".$mformat.str_replace('&','-',$row[6])." target='_blank'>$row[2]</a></td>"."</td><td><center><b>".$row[1]."</td><td><center><b>".$row[0]."</td><td><center><b>".$row[11]."</td><td align=right><b>".putcoma($row[3])."</tr>";
}
?>

