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

?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Survey Application</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/page.css">
<link href="css/admincss.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="css/ddsmoothmenu.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="js/ddsmoothmenu.js">
</script>

<script type="text/javascript">

ddsmoothmenu.init({
	mainmenuid: "smoothmenu1", //menu DIV id
	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
	classname: 'ddsmoothmenu', //class added to menu's outer DIV
	//customtheme: ["#1c5a80", "#18374a"],
	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})



</script>
<style type='text/css' media='print'>
#prnt {display : none}
#header{display:none;}
#footer{display:none;}
#back {display : none}

</style>
</head>

<body class="body">

<div id="wrap" >
  
  
  <div id="top">
    <?php include("header.php"); ?>
    <!--<div id="ban"><table width="1004" align="left"  >
  <tr>
    <td width="234"  align="left"  valign="top" ><img src="images/logoss.jpg" border="0" /></td>
    <td  valign="top" style="padding-top:5px;" width="758"  align="right" ><table align="left" width="707">
  <tr>
    <td width="386" align="left"><div ><a href="#" id="bantext1">REQUEST A DEMO</a></div></td>
    <td width="167" align="left"><div ><a href="#" id="bantext2">DOWNLOADS</a></div></td>
    <td width="138" align="left"><div ><a href="#" id="bantext2">DOWNLOADS</a></div></td>
  </tr>
  <tr>
    <td colspan="3" align="center" class="banquot">Be Smart and Survey Smartly </td>
  </tr>
</table></td>
    
    
  </tr>
</table>
    </div>-->
    
    </div>
    </div>
   <div id="menuholder"><?php include("adminmenu.php"); ?></div>
   <div id="contholder">
   
    
    <!--<div id="nav">
     <ul>
     <li><a href="adminhome.php" id="home_on">HOME</a></li>
        <li><a href="adminproducts.php" id="products_on">PRODUCTS</a></li>
		<li><a href="adminfeatures.php" id="features_on">FEATURES</a></li>
        <li><a href="adminadvantages.php" id="advantages_on">ADVANTAGES</a></li>
        <li><a href="adminhowitworks.php" id="howitworks_on">HOW IT WORKS</a></li>
        <li><a href="adminhelp.php" id="help_on">HELP</a></li>
        <li><a href="admincontactus.php" id="contactus_on">CONTACT US</a></li>
    
    </ul>
    
    </div>-->
    
    
    	<div id="contdata">
  <hr width="80%"></hr>
<center><font face="Verdana" size="2"><b>Date and Pincode wise report </b></font></center>
<hr width="80%"></hr>
<br>
<table border='0' width='80%'  align='center'  style='font-family:Verdana; font-size:10pt; border-collapse: collapse;'>
    <tr>
        <td align="right">
            <input type="button" value="Print" id="prnt" name="print" onClick="window.print()" align="center" >
            <a href="report_date_pin.php" id="back"style="text-decoration:none; "><input type="button" value="Cancel" name="cancel" >  </a>
        </td>
    </tr>
</table>
<br>
<?php
	if($_GET['x']!="")
{	
	$date1=$_GET["x"];
	$dateq1=$_GET["y"];
	$pincode=$_GET["pincode"];
 	$sql="SELECT * FROM input_form WHERE current_date1 between '".$date1."' and '".$dateq1."' and pincode='".$pincode."'  ";
	$result = mysql_query($sql);



$j=explode("-",$date1);
	$start_date = $j[2]."-".$j[1]."-".$j[0];
	//echo "new date--- ".$show_date;
	
	$i=explode("-",$dateq1);
	$end_date = $i[2]."-".$i[1]."-".$i[0];


echo "<center><b><font face='Verdana' size='2'>From  </font> ".$start_date ."<font face='Verdana' size='2'>$nbsp To </font> ".$end_date ."</b><br/><br/></center>";	
echo "<center><b><font face='Verdana' size='2'>Pincode </font> ".$pincode ."</b><br/><br/></center>";



echo "<table border='1' align='center'  style='font-family:Verdana; font-size:10pt; border-collapse: collapse; width:auto'>
<tr>

<th align='left'>Ward Office</th>
<th align='left'>Survey Sheet No</th>
<th align='left'>Ward</th>
<th align='left'>Date</th>
<th align='left'>Sub Area</th>
<th align='left'>MSEB Number</th>
<th align='left'>Plot No</th>
<th align='left'>Society Name</th>
<th align='left'>Pincode</th>
<th align='left'>City</th>
<th align='left'>State</th>
<th align='left'>Country</th>
<th align='left'>Owner</th>
<th align='left'>House No</th>
<th align='left'>Total Area</th>
<th align='left'>Type</th>
<th align='left'>Other Information</th>
<th align='left'>Informer</th>
<th align='left'>Surveyor</th>
<th align='left'>Tree Records</th>

</tr>";

while($row = mysql_fetch_array($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);
	
	$query_surveyor = mysql_query("select * from login where lid= '".$row['surveyor']."'");
	$result_surveyor = mysql_fetch_array($query_surveyor);
	
  echo "<tr>";
	  echo "<td align ='left' style='vertical-align:top'>" . $result_ward['wvalue'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['survey_sheet_no'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $result_sub['dvalue'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['current_date1'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['sub_area'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['mseb'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['plot_no'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['society_name'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['pincode'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['city'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['state'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['country'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['owner'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['house_no'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['plot_area'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['type'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['miscellaneous'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['informer'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $result_surveyor['username'] . "</td>";
	  echo "<td>";
  
	
	$query1="select * from info where aid='".$row['id']."'";
 	$rest1=mysql_query($query1);

 	echo "<table border='1'   align='center'  style='font-family:Verdana; font-size:10pt; border-collapse: collapse; width:auto'>

 <tr>
<th align ='left'>Tree Name</th>
<th align ='left'>Scientific Name</th>
<th align ='left'>Width </th>
<th align ='left'>Height </th>
<th align ='left'>Diameter of Tree (In Feet) </th>
<th align ='left'>Age </th>
<th align ='left'>Condition </th>
<th align ='left'>Longitude </th>
<th align ='left'>Latitude </th>
</tr>";

while($row = mysql_fetch_array($rest1))
  {
	  
	  $query_tree = mysql_query("select * from tree_name where tid= '".$row['tree_name']."'");
	$result_tree = mysql_fetch_array($query_tree);
	  
  echo "<tr>";
	  echo "<td align ='left' style='vertical-align:top'>" . $result_tree['tree_name'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $result_tree['scientific_name'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['width'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['height'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['diameter_of_tree'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['age'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['con'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['lng'] . "</td>";
	  echo "<td align ='left' style='vertical-align:top'>" . $row['lat'] . "</td>";
	  	  
  echo "</tr>";
  }
  echo "</table>";
  echo "</td>";
  echo "</tr>";
  }
  echo "</table>";
?>
</table>
<?php
echo "</td>";
 
}
?>
	<?php include("footer.php"); ?>	
		</div>
    
   
    

    	
   </div> 

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





</body>
</html>