<?php include("session_start.php");
include("session_check.php");
include("database.php");
if($_GET['q']!="")
{	
	$q=$_GET["q"];
	
	$sql1= mysql_fetch_array(mysql_query("select * from login where lid='$q'"));
	//echo "select * from login where lid='$q'";
	
	$sql="SELECT * FROM input_form   WHERE surveyor= '".$sql1['lid']."'  ";
	//echo "SELECT * FROM input_form  WHERE surveyor= '".$sql1['surveyor_name']."'  ";
	
	$rest=mysql_query($sql);
	
	
	
	$num = mysql_num_rows($rest); if($num >0){?>
    <a href="print_surveyor_report.php?q=<?php echo $q?>"> <input type="button" bgcolor="#a9c1de"  name="print" id="print" value="Print"  style="text-decoration:none" class="button_c" onClick=""></a>
    <table border="1" cellpadding="2" cellspacing="2" width="100%" align="center" bordercolor="#bcd5e7" >
	   
	 <tr>
    	 
        <td align="left" ><font class="font4"><b>View</font></td>
      
        <td align="left"><font class="font4"><b>Ward Office</font></td>
        <td align="left"><font class="font4"><b>Ward</font></td>
        <td align="left"><font class="font4"><b>Date</font></td>
        <td align="left"><font class="font4"><b>Society Name</font></td>
        <td align="left"><font class="font4"><b>Tree Records</font>
        
        
        </td>
     </tr>
     <?php
   while ($row =@mysql_fetch_object($rest)) 
{
	$query_ward = mysql_query("select * from master_ward where wid= '".$row->ward_office."'");
	$result_ward = mysql_fetch_array($query_ward);
	
	$query_sub = mysql_query("select * from master_ward_drop where did= '".$row->ward."'");
	$result_sub = mysql_fetch_array($query_sub);
	
	$date = $row->current_date1;
	//echo $date;
	$j=explode("-",$date);
	$show_date = $j[2]."-".$j[1]."-".$j[0];
	
	echo "<tr>";
	
	echo "<td align='center' style='vertical-align:top'><a href='view_records.php?id=$row->id'><font class='font4'>"."<img src='images/view.png' border='0'>"."</font></div></td>";


echo "<td  align='left' style='vertical-align:top'>"."<div align='left'>"."<font class='font4'>".$result_ward['wvalue']."</font></div></td>";
echo "<td  align='left' style='vertical-align:top'>"."<div align='left'>"."<font class='font4'>".$result_sub['dvalue']."</font></div></td>";
echo "<td  align='left' style='vertical-align:top'>"."<div align='left'>"."<font class='font4'>".$show_date."</font></div></td>";
echo "<td  align='left' style='vertical-align:top'>"."<div align='left'>"."<font class='font4'>".$row->society_name."</font></div></td>";
echo "<td>";
?>
	<table align="center" border="1" width="100%" bordercolor="#bcd5e7">
    	<tr>
        	
        	
            <td align="left" ><font class="font4"/><b> Tree Name </td>
            <td align="left" ><font class="font4"/><b> Scientific Name </td>
            <td align="left" ><font class="font4"/><b> Latitude </td>
            <td align="left" ><font class="font4"/><b> Longitude </td>
         </tr>
<?php
$query1="select * from info where aid='".$row->id."'";
 $rest1=mysql_query($query1);
while($row1 = @mysql_fetch_object($rest1))
{
	
	$query_tree = mysql_query("select * from tree_name where tid= '".$row1->tree_name."'");
	$result_tree = mysql_fetch_array($query_tree);
	
echo "<tr>		<td align='left' style='vertical-align:top'>"."<div align='left'>"."<font class='font4'>".$result_tree['tree_name']."</font></div></td>
				<td align='left' style='vertical-align:top'>"."<div align='left'>"."<font class='font4'>".$result_tree['scientific_name']."</font></div></td>
				<td align='left' style='vertical-align:top'>"."<div align='left'>"."<font class='font4'>".$row1->lat."</font></div></td>
				<td align='left' style='vertical-align:top'>"."<div align='left'>"."<font class='font4'>".$row1->lng."</font></div></td>
			</tr>
		
	";
}?>
</table>
<?php
echo "</td>";
}

?>

</table>
    
<?php }else
{
	echo "No Records To Display";
}
}


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Survey Application</title>
</head>

<body>
</body>
</html>