<?
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;
}
$d1=$_REQUEST['d1'];
$m1=$_REQUEST['m1'];
$y1=$_REQUEST['y1'];
$d2=$_REQUEST['d2'];
$m2=$_REQUEST['m2'];
$y2=$_REQUEST['y2'];
$show=$_REQUEST['show'];
include("opendb.php");
include("test.php");
include("includes/top.php");
?>
<link href="css/form.css" type="text/css" rel="stylesheet" media="screen"  />
<html>
<body >

<?
if($show=='show')
{
$_POST['show']=$show;
}
if(isset($_POST['show']))
{
$d1=$_REQUEST['d1'];
$m1=$_REQUEST['m1'];
$y1=$_REQUEST['y1'];
$d2=$_REQUEST['d2'];
$m2=$_REQUEST['m2'];
$y2=$_REQUEST['y2'];

$dfrom=$y1.'-'.$m1.'-'.$d1;
$dto=$y2.'-'.$m2.'-'.$d2;
$led = $_REQUEST['led'];
?>

<center>

<form action='<?print $PHP_SELF?>' method='POST'>
<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>
<?

$led=getbrled($brcode);

$sql="select * from journal2  where partic='$led'  and date>='$dfrom' and date<='$dto' and brcode!='$brcode' and j_type!='CH' and j_type!='GRN' and against!='done' order by brcode";
//echo $sql;
//echo "<br>";
 $result=mysqli_query($db,$sql)or die(mysqli_error($db));
print "<table align='center' 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='clr_adv1.php' method='POST'>
 <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='narr' value='$row[6]'>";

 
 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>";
}
return;
}

?>
</table>
<center>
<form action='<?Print $PHP_SELF?>' method='POST' >
<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>Date from </td><td>dd <input type=text  name='d1' size=2 value='01'>
mm <input type=text  name='m1' size=2 value='04'>
yy <input type=text   name='y1' size=4 value='2018'></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>
 
