
<link type="text/css" href="includes/style1.css" rel="stylesheet" />
<link type="text/css" href="css/form1.css" rel="stylesheet" />
<?
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../index.html'; </script>";
 return;
}
include("opendb.php");
include("test.php");
include('includes/top.php'); 

?>
<center>
<h3><font color='white'>OBSERVATION REPORT</H3>
<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 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>
<?
if($show)
{
?>
<style>

	td,th,body{font-size:14;font-family:'arial narrow';letter-spacing:1}

       th{
           color:white;
        }
</style>
<center>

  
 <table  style='border:1px solid grey;border-collapse:collapse;width:110%' border=1 bgcolor='#F8F8F8' >
<?
 print "<tr bgcolor='black' color='white'><th>Slno<th>Jcno<th>Invno<th width='5%'>Inv_date<th>Regno<th>Model<th>Chasisno<th>Customer<th> Mob<th>Rec by<th>Observ Repo<th>Action</tr>";

 $dfrom=$y1.'-'.$m1.'-'.$d1;
 $dto=$y2.'-'.$m2.'-'.$d2;

$qry2=mysqli_query($db,"select jcno,inv_date,invno,regno,model,chasisno,customer,mobile,receivedby from gateentry where inv_date between '$dfrom' and '$dto' and brcode='$brcode' and invno>0 ");

$i=1;
while($res=mysqli_fetch_array($qry2))
{
 
 $j=1;

 print "<tr  >";
 print"<td>".$i."</td><td height='45'  align='left' > $res[0] </td><td> $res[2]</td><td> ".datetoHtml($res[1])."</td><td> $res[3]</td><td> $res[4]</td><td>$res[5]</td><td>$res[6]</td><td>$res[7]</td><td> $res[8]</td><td>";

  $qry3=mysqli_query($db,"select observ,date from observation_repo where jcno='$res[0]' and brcode='$brcode'");

  print "<table border=0  width=100%>";

    while($res3=mysqli_fetch_array($qry3))
	{



 		 print "<tr ><td >".$j++.".</td><td colspan=7 width='80%'>$res3[0]</td> <td colspan=2>".datetoHtml($res3[1])."</td></tr>";

       }

   if($j==1){

 			
             print "<tr><td height=100% >No Observation Report created</td></tr>";
  }

?>
 </table></td><td style='font-style:bold;'><a   onclick="edit('<? echo $res[0];?>')"  target='blank' >Edit</a>/<a   onclick="print('<? echo $res[0];?>')"  target='blank' >Print</a></td></tr>
<?
$i++;
 
}//close while loop

}//close show1 condition
?>
</body>


<script>

 function edit(jcno)
{

window.open("observation_new.php?jcno="+jcno+"&&show=show");
}

function print(jcno)
{

window.open("print_observ_repo.php?jcno="+jcno);
}

</script>


