<?php
$filename = "Report";
header("Cache-control: private");
header('Content-Encoding: UTF-8');
header("Content-Transfer-Encoding: binary");
header("Content-type: application/msexcel; charset=UTF-8");
header("Content-Disposition:attachment; filename=".$filename.".xls");
?>


    
    <?php $k =0;?>
<html>
    <head>
       
    </head>
    <body>
   <table width="100%" align="left" border="0">
      <tr>
	  <td>Sl.No.</td>
    <td>Survey Date</td>
	  <td>Name</td>
    <td>Address</td>
    <td>Village</td>
    <td>Ward no</td>
    <td>Ration card no</td>
	  <td>House no</td>
	  <td>ration shop no</td>
    <td>Ration card color</td>
    <td>Land</td>
    <td>Land in cent</td>
    <td>Ayalkootam Name</td>
    
    <td>Ayalkootam Ward No</td>
    <!-- <td>Aadhaar No</td>
    <td>Ration card Available</td>
     <td>Ration card No</td>
    <td>Jobcard Available</td>
    <td>Jobcard No</td>
    <td>Included in baseline survey list</td>
    <td>Electricity Bill RR No</td>
    <td>Electricity Available</td>
    <td>Bank Account Available</td>
     <td>Bank Name</td>
      <td>Branch Name</td>
      <td>Bank Account No</td>
      <td>IFSC Code</td>
      <td>APL/BPL</td>
      <td>Small/Marginal Farmer</td>
    <td>Physically Handicapped</td>
    <td>Landless Labour</td>
    <td>Women centric family</td>
    <td>Open place available or not</td>
    <td>Willing for toilet construction</td>
    <td>Willing to avail Bank loan </td>
    <td>Requires raw materials </td>
    <td>Need Readymade toilet</td> -->
    <td>Agent Name</td>
	  
	  </tr>
	   
		 <tr>
		 <?php 
		 $i=1;
	     foreach($details as $row)
	    {?> 
		 <td> <?php echo $i++; ?></td> 
          <td><?php  if(isset($row['suvey_date']) && $row['suvey_date'] !='' && $row['suvey_date'] !='0'){ echo date('d-m-Y', strtotime($row['suvey_date'])); }?></td> 
		 <td> <?php  if(isset($row['name']) && $row['name'] !='' && $row['name'] !='0'){ echo $row['name']; }?></td>
      <td> <?php  if(isset($row['address']) && $row['address'] !='' && $row['address'] !='0'){ echo $row['address']; }?></td>
		 <td> <?php  if(isset($row['village']) && $row['village'] !='' && $row['village'] !='0'){ echo $row['village']; }?></td>
     <td> <?php  if(isset($row['ward_no']) && $row['ward_no'] !='' && $row['ward_no'] !='0'){echo $row['ward_no'];}?></td>
      <td> <?php  if(isset($row['ration_card_no']) && $row['ration_card_no'] !='' && $row['ration_card_no'] !='0'){ echo $row['ration_card_no']; }?></td>
     <td> <?php if(isset($row['house_no']) && $row['house_no'] !='' && $row['house_no'] !='0'){ echo $row['house_no']; }?></td>  
		 <td> <?php if(isset($row['ration_shop_no']) && $row['ration_shop_no'] !='' && $row['ration_shop_no'] !='0'){ echo $row['ration_shop_no']; }?></td>
     <td> <?php if(isset($row['ration_card_color']) && $row['ration_card_color'] !='' && $row['ration_card_color'] !='0'){ echo $row['ration_card_color']; }?></td>
		 
     
     
    

      <?php  if(isset($row['land']) && $row['land'] !='' && $row['land'] !=''){ ?><td><?php echo $row['land']; ?></td><?php } ?>
      
     
     
     <td> <?php  if(isset($row['land_cent']) && $row['land_cent'] !='' && $row['land_cent'] !='0'){ echo $row['land_cent']; }?></td>

     <td> <?php  if(isset($row['ayalkootam_name']) && $row['ayalkootam_name'] !='' && $row['ayalkootam_name'] !='0'){ echo $row['ayalkootam_name']; }?></td>
     <td> <?php  if(isset($row['ayalkootam_ward_no']) && $row['ayalkootam_ward_no'] !='' && $row['ayalkootam_ward_no'] !='0'){ echo $row['ayalkootam_ward_no']; }?></td>
      <!-- <td>
      <?php  if(isset($row['aadhar_avail']) && $row['aadhar_avail'] !='' && $row['aadhar_avail'] !='0'){ echo $row['aadhar_avail']; }?> 
     </td>
     <td> <?php  if(isset($row['ration_card']) && $row['ration_card'] !='' && $row['ration_card'] !='0'){ echo $row['ration_card']; }?></td>
      <td> <?php  if(isset($row['rationcard_avail']) && $row['rationcard_avail'] !='' && $row['rationcard_avail'] !='0'){ echo $row['rationcard_avail']; }?></td>
     <td> <?php  if(isset($row['jobcard']) && $row['jobcard'] !='' && $row['jobcard'] !='0'){ echo $row['jobcard']; }?></td>

     <td> <?php  if(isset($row['jobcard_avail']) && $row['jobcard_avail'] !='' && $row['jobcard_avail'] !='0'){ echo $row['jobcard_avail']; }?></td>
     <td> <?php  if(isset($row['name_base_line_survey']) && $row['name_base_line_survey'] !='' && $row['name_base_line_survey'] !='0'){ echo $row['name_base_line_survey']; }?></td>

     <td> <?php  if(isset($row['electric_bill']) && $row['electric_bill'] !='' && $row['electric_bill'] !='0'){ echo $row['electric_bill']; }?></td>
     <td> <?php  if(isset($row['electic_bill_avail']) && $row['electic_bill_avail'] !='' && $row['electic_bill_avail'] !='0'){ echo $row['electic_bill_avail']; }?></td>
     <td> <?php  if(isset($row['back_acc']) && $row['back_acc'] !='' && $row['back_acc'] !='0'){ echo $row['back_acc']; }?></td>


     <td> <?php  if(isset($row['bank_name']) && $row['bank_name'] !='' && $row['bank_name'] !='0'){?><?php  echo $row['bank_name']; }?></td>
     <td> <?php  if(isset($row['branch_name']) && $row['branch_name'] !='' && $row['branch_name'] !='0'){?><?php  echo $row['branch_name']; }?></td>
    <td> <?php  if(isset($row['bank_account_avail']) && $row['bank_account_avail'] !='' && $row['bank_account_avail'] !='0'){ ?> <?php  echo $row['bank_account_avail']; }?></td>
     <td> <?php  if(isset($row['ifc_code']) && $row['ifc_code'] !='' && $row['ifc_code'] !='0'){ ?> <?php  echo $row['ifc_code']; }?></td>

     <td> <?php  if(isset($row['cat_bpl_apl']) && $row['cat_bpl_apl'] !='' && $row['cat_bpl_apl'] !='0'){ echo $row['cat_bpl_apl']; }?></td> 
     <td> <?php  if(isset($row['cat_farmer']) && $row['cat_farmer'] !='' && $row['cat_farmer'] !='0'){ echo $row['cat_farmer']; }?></td>
     <td> <?php  if(isset($row['handicapped']) && $row['handicapped'] !='' && $row['handicapped'] !='0'){ echo $row['handicapped']; }?></td>
     <td> <?php  if(isset($row['landless_labour']) && $row['landless_labour'] !='' && $row['landless_labour'] !='0'){ echo $row['landless_labour']; }?></td>

     <td> <?php  if(isset($row['women_centric_family']) && $row['women_centric_family'] !='' && $row['women_centric_family'] !='0'){ echo $row['women_centric_family']; }?></td>

    <td> <?php  if(isset($row['open_place_avil_or_not']) && $row['open_place_avil_or_not'] !='' && $row['open_place_avil_or_not'] !='0'){ echo $row['open_place_avil_or_not']; }?></td>
    <td>  <?php  if(isset($row['toilet_construction']) && $row['toilet_construction'] !='' && $row['toilet_construction'] !='0'){?><?php  echo $row['toilet_construction'];?><?php  }?></td>
    <td>  <?php  if(isset($row['bank_loan']) && $row['bank_loan'] !='' && $row['bank_loan'] !='0'){?> <?php echo $row['bank_loan'];?><br/><?php  }?></td>
     <td>   <?php  if(isset($row['material_for_construction']) && $row['material_for_construction'] !='' && $row['material_for_construction'] !='0'){?><?php  echo $row['material_for_construction']; ?><?php  }?></td>
    <td>  <?php  if(isset($row['readymade_toilet']) && $row['readymade_toilet'] !='' && $row['readymade_toilet'] !='0'){?>  <?php echo $row['readymade_toilet']; }?></td> -->

     <td><?php if(isset($row['agent_name']) && $row['agent_name'] !='' && $row['agent_name'] !='0'){ echo $row['agent_name']; }?></td>  
		
		 </tr>
	  <?php 
	  } ?> 
 
      </tr>
    </table>
    </body>
</html>