<?
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Invalid Login'); parent.document.location='ind.php' </script>";
 return;
}
include("opendb.php");
include("test.php");

?>
<link rel="stylesheet" href="../style.css" type="text/css" />
<style>
body,td{font-family:arial narrow;font-size:14}
</style>
<center>

<form action='<?print $PHP_SELF?>' name='f1'>
<table border=1 width=250>
<tr><td>Enter Narration or chq no: or amount</td><td><input type=text name=sea size=20>
</td><td colspan=2 align=center><input type=submit value="Show" name='show'></td></tr>
</table>
</form>

<?
if($show)
{
print "<hr style={background-color:green;color:green}>";

$re=mysqli_query($db,"select distinct jvno,date,type from journal2 where brcode='$brcode' and  (narr like'%$sea%' or no='$sea' or dramt='$sea' or cramt='$sea') group by jvno order by date")or die(mysqli_error());
print "<table bgcolor='ivory' border=0 cellspacing=3 cellpadding=1 width=100%> \n<th>Tr. No <th>Date <th>Particulars <th>Debit <th>Credit <th>Narration <th width=50>Type<th>Ref <th>No";
$ed=0;
while($row=mysqli_fetch_array($re))
{
 $ed=0;
  $re2=mysqli_query($db,"select * from journal2 where jvno='$row[jvno]' and brcode='$brcode'") or die(mysqli_error());
  print "\n<tr bgcolor='silver'><td>$row[jvno]</td><td>".datetohtml($row[date])."</td><td></td>";
  print "\n<td></td><td></td><td></td><td></td>";
 print "<td> </td><td></td>";
    while($jvrow=mysqli_fetch_array($re2))
    {
        print "\n<tr><td>&nbsp;</td><td>&nbsp;</td><td>$jvrow[partic]</td>";
        print "<td align=right>".nozero($jvrow[dramt])."</td>";
        print "<td align=right>".nozero($jvrow[cramt])."</td><td>$jvrow[narr]</td><td>$jvrow[j_type]</td><td>$jvrow[against]</td><td>$jvrow[no]</td></tr>";
 if($jvrow[j_type]=='CR' || $jvrow[j_type]=='CP' ||$jvrow[j_type]=='BP' || $jvrow[j_type]=='BR' || $jvrow[j_type]=='JV'|| $jvrow[j_type]=='TDSJV')
    $ed='1';
/* else
   $ed='0';*/
 }
     print "<tr><td colspan=9 bgcolor=silver></td></tr>";

}
}
?>

