<?php 
include("database.php");

if($_GET['date1'])
{
	$date1=$_GET["date1"];
	$j = explode("-",$date1);
	$d1 = str_split($j[0]);
	if($d1[0]=="0")
	{
		$dates = $j[2].'-'.$j[1].'-'.$d1[1];
	}
	else
	{
		$dates = $j[2].'-'.$j[1].'-'.$j[0];
	}
	
	$date2=$_GET["date2"];
	//echo $date2;
	$i = explode("-",$date2);
	$d2 = str_split($i[0]);
	//echo $d2[0];
	if($d2[0]=="0")
	{
		$datee = $i[2].'-'.$i[1].'-'.$d2[1];
		//echo $datee;
	}
	else
	{
		$datee = $i[2].'-'.$i[1].'-'.$i[0];
	}
	
	$pincode=$_GET["pincode"];
	
	$sql="SELECT * FROM input_form WHERE current_date1 between '".$dates."' and '".$datee."' and pincode='".$pincode."' ";
	//echo $sql;
	$result = mysql_query($sql);
	$num = mysql_num_rows($result); if($num >0){
	?>

     <a href="print_datepinwise_report.php?x=<?php echo $dates?>&y=<?php echo $datee?>&pincode=<?php echo $pincode?>" style="text-decoration:none"> <input type="button" bgcolor="#a9c1de"  name="print" id="print" value="Print"   class="button_c" onClick=""></a>
     <br />
<table border="1" cellpadding="2" cellspacing="2" width="100%" align="center" bordercolor="#bcd5e7" ><br />
	 <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($result)) 
{
	$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);
	
	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'>".$row->current_date1."</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> pid </td>
            <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> Longitude </td>
            <td align="left" ><font class="font4"/><b> Latitude </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' style='vertical-align:top'>"."<font class='font4'>".$row1->pid."</font></div></td>
				<td align='left' style='vertical-align:top'>"."<div align='left' style='vertical-align:top'>"."<font class='font4'>".$result_tree['tree_name']."</font></div></td>
				<td align='left' style='vertical-align:top'>"."<div align='left' style='vertical-align:top'>"."<font class='font4'>".$result_tree['scientific_name']."</font></div></td>
				<td align='left' style='vertical-align:top'>"."<div align='left' style='vertical-align:top'>"."<font class='font4'>".$row1->lng."</font></div></td>
				<td align='left' style='vertical-align:top'>"."<div align='left' style='vertical-align:top'>"."<font class='font4'>".$row1->lat."</font></div></td>
			</tr>
		
	";
}?>
</table>
<?php
echo "</td>";
}

?>

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

    	
   </div> 

<!--<div id="footer">Copyright © 2012.Smart Survey All Rights Reserved.Website Designed & Developed by Kalpak Solutions</div>-->





</body>
</html>