<?
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='ind.php'; </script>";
 return;
}
include("opendb.php");
include("test.php");
?>
<link href="css/form.css" type="text/css" rel="stylesheet" media="screen"  />
<html>
<body >

<?
if($show)
{
$dfrom=$y1.'-'.$m1.'-'.$d1;
 $dto=$y2.'-'.$m2.'-'.$d2;

?>



<form action='<?print $PHP_SELF?>'>
<table border=1>
<tr><td align=center>Form No. <input type=text name='seafno' size=5> customer Name <input type=text name='seaname'></td><td>
<td>
<input type=submit value='Search' name='sea'>
</td></tr>
</table>
</form>
<font color=green size=4><b><u>Entries passed by branches to your a/c </b></u>
<?

if($brcode=='Aut141')
{
$led="AUTOMOTIVE MARKET- VEH DIV,CLT";
$led1="AUTOMOTIVE MARKETING PVT. LTD.";
$led2="AUTOMOTIVE MARKETING PVT. LTD- CALILUT";
}
elseif($brcode=='PSN236')
{
$led="PSN AUTOMOBILES PVT. LTD.";
$led1="P.S.N.AUTOMOBILES PVT LTD,VEHICLE";
$led2="PSN AUTOMOBILES PVT. LTD.";
}

if($brcode=='AUT009')
{
$led="AUTOMOTIVE MARKETING P LTD- MANGALORE";
$led1="AMPL MANGLORE";
$led2="AUTOMOTIVE MARKETING PVT. LTD., MANGALORE";
}

if($brcode=='AUT103')
{
$led="AMPL BANGALORE";
$led1="AUTOMOTIVE MARKETING P LTD- BANGALORE";
$led2="AUTOMOTIVE MARKETING -BANGALORE";
}



$sql="select * from journal2  where partic='$led' or partic='$led1' or partic='$led2'  and date>='$dfrom' and date<='$dto' and brcode!='$brcode' and  against!='done' ";
print $sql;

 $result=mysqli_query($db,$sql)or die(mysqli_error());
print "<table border=1> \n<th>SL. <th>Clear<th>Date <th>Jvno <th> Dr/Cr <th>Branch<th>Amount Dr<th>Amount Cr<th>Trans.Type<th>Narration";
$i=1;
while($row=mysqli_fetch_array($result))
{
$led=getbrname($row[7]);
$amt=$row[5]+$row[4];
 print "\n<form action='veh/clr_adv1.php'>
 <input type=hidden name='fno' value='$row[jvno]'>";
 print "<input type=hidden name='amt' value='$amt'>";
 print "<input type=hidden name='name' value='$led'>";
 print "<input type=hidden name='type' value='$row[type]'>";
 print "<input type=hidden name='dfrom' value='$dfrom'>";
 print "<input type=hidden name='dto' value='$dto'>";


 
 print "<input type=hidden name='brc' value='$row[brcode]'>";

if($row[j_type]=='JV')
$ptype='JV';
else if($row[j_type]=='CP')
$ptype='CR';
else if($row[j_type]=='CR')
$ptype='CP';
else if($row[j_type]=='BP')
$ptype='BR';
else if($row[j_type]=='BR')
$ptype='BP';
print "<input type=hidden name='ptype' value='$ptype'>";


 print "\n<tr><td>".$i++."</td><td align=center><input type=submit value='Clear'></td><td>".datetohtml($row[0])."</td><td>$row[1]</td>";
 print "<td>$row[2]</td><td>".getbrname($row[7])."</td><td>$row[4]</td><td>$row[5]</td><td>$row[8]</td><td>$row[6]</td>";
 print "\n</tr></form>";
}
}
?>
</table>


<form action='<?Print $PHP_SELF?>' >
<table cellspacing=1 cellpadding=1 bgcolor='steelblue'>
<tr><td bgcolor='white' align=center>
<table class=noprint>
<tr><td>Date from </td><td>dd <input type=text name='d1' size=2 value='<?print date("d")?>'>
mm <input type=text name='m1' size=2 value='<?print date("m")?>'>
yy <input type=text name='y1' size=4 value='<?print date("Y")?>'></td></tr>

<tr><td align=right>to </td><td>dd <input type=text name='d2' size=2 value='<?print date("d")?>'>
mm <input type=text name='m2' size=2 value='<?print date("m")?>'>
yy <input type=text name='y2' size=4 value='<?print date("Y")?>'>
</td></tr>

<tr><td colspan=2 align=center bgcolor='lightsteelblue'><input type=submit value='Show' name='show'></td></tr>
</table>
</td></tr>
</table>


</form>
 
