<?php
ob_start();
require_once './configs/webconfig.php';
require_once './utility/common_model.php';

require_once './controller/admin_controller.php';

$MyPdodb = new MyPDO();	

		$MyPdodb->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('MyPDOStatement'));		
		
		
		$sql = "SELECT *from hi_family order by id asc"; 
		
				$stm  = $MyPdodb->prepare($sql);      		
				$stm->execute(array($start,$limit));
				$results = $stm->fetchAll(PDO::FETCH_CLASS);
				
				
				
				$exportData = $results;
?>

<?php
	$totalHours =0;
	if(count($exportData)> 0) {
		foreach ($exportData as $project) { 	
			$totalHours += 	$project->hours;	
		}
	}
?>
    <table class="" width="100%" border="0">	                
                  <?php  if(count($exportData)> 0) {?>   
                 
                                 
      				<tr>
                    <td align="center" valign="top">                         
                        <table class="bordered-table zebra-striped dataTable" width="100%" id="datagrid">                        
                         <thead>
                          <tr>                            
                            <th align="left"><strong>Name</strong></th>
                            <th align="left"><strong>Gender</strong></th>
                            <th align="left"><strong>Blood Group</strong></th>
							<th align="left"><strong>Birth Date</strong></th>
							<th align="left"><strong>Anniversary Date</strong></th>
							<th align="left"><strong>Native Place</strong></th>
							<th align="left"><strong>Marital Status</strong></th>
							<th align="left"><strong>Address1</strong></th>
							<th align="left"><strong>Address2</strong></th>
							<th align="left"><strong>City</strong></th>
							<th align="left"><strong>State</strong></th>
							<th align="left"><strong>Country</strong></th>
							<th align="left"><strong>Zip</strong></th>
							<th align="left"><strong>Phone</strong></th>
							<th align="left"><strong>Mobile</strong></th>
							<th align="left"><strong>Email</strong></th>
							<th align="left"><strong>Photo File Name</strong></th>
							<th align="left"><strong>Education</strong></th>
							<th align="left"><strong>Occupation</strong></th>
							<th align="left"><strong>Name of Company</strong></th>
							<th align="left"><strong>Designation</strong></th>
							<th align="left"><strong>Business Address1</strong></th>
							<th align="left"><strong>Business Address2</strong></th>
							<th align="left"><strong>Business City</strong></th>
							<th align="left"><strong>Business State</strong></th>
							<th align="left"><strong>Business Country</strong></th>
							<th align="left"><strong>Business Zip</strong></th>
							<th align="left"><strong>Business Phone</strong></th>
							<th align="left"><strong>Business Website</strong></th>
							<th align="left"><strong>Business Email</strong></th>
							<th align="left"><strong>Business Nature</strong></th>
							<th align="left"><strong>No. of Family Members</strong></th>
							<th align="left"><strong>Anniversary Date</strong></th>
                          </tr>
                        </thead>                     
                         <tbody>
						   <?php				  
                           $i=$start;						   
                          foreach ($exportData as $project) { 							  
                            $i++;				  							              
                          ?>
                          <tr>
                             <td align="left"><?php echo $project->fam_fullname?></td>
                             <td align="left"><?php echo $project->fam_gender?></td>                             
                             <td align="left"><?php echo $project->fam_bloodgroup?></td>
							 <td align="left"><?php 
							 if($project->fam_dob!="" and $project->fam_dob!="0000-00-00"){
							 	echo date("d-m-Y",strtotime($project->fam_dob));
							 }
							 ?></td>
							 <td align="left"><?php 
							 if($project->fam_expirydate!="" and $project->fam_expirydate!="0000-00-00"){
							 	echo date("d-m-Y",strtotime($project->fam_expirydate));
							 }
							 ?></td>
                             <td align="left"><?php echo $project->nativeplace?></td>                                                        
                             <td align="left"><?php echo $project->maritalstatus?></td>   
							 
							 <td align="left"><?php echo $project->address1?></td>                         
							 <td align="left"><?php echo $project->address2?></td>                         
                             <td align="left"><?php echo $project->city?></td>                         
                             <td align="left"><?php echo $project->state?></td>
							 <td align="left"><?php echo $project->country?></td>
							 <td align="left"><?php echo $project->zip?></td>
							 <td align="left"><?php echo $project->phone?></td>
							 <td align="left"><?php echo $project->mobile?></td>
							 
							 <td align="left"><?php echo $project->email?></td>
							 
							<td align="left"><?php echo $project->simage?></td>
							<td align="left"><?php echo $project->education?></td>  
							<td align="left"><?php echo $project->occupation?></td>                        
                            <td align="left"><?php echo $project->bus_nameofcompany?></td>
							<td align="left"><?php echo $project->bus_designation?></td>  
							<td align="left"><?php echo $project->bus_address1?></td>                         
                            <td align="left"><?php echo $project->bus_address2?></td>                         
							
							<td align="left"><?php echo $project->bus_city?></td>
							 <td align="left"><?php echo $project->bus_state?></td>
							 <td align="left"><?php echo $project->bus_country?></td>
							 <td align="left"><?php echo $project->bus_zip?></td>
							 <td align="left"><?php echo $project->bus_phone?></td>
							 <td align="left"><?php echo $project->bus_website?></td>
							 <td align="left"><?php echo $project->bus_email?></td>
							 <td align="left"><?php echo $project->bus_nature?></td>
							 <td align="left"><?php echo $project->nooffamilymembers?></td>
							<td align="left"><?php 
							 if($project->expirydate!="" and $project->expirydate!="0000-00-00"){
							 	echo date("d-m-Y",strtotime($project->expirydate));
							 }
							 ?></td>
							 
							 
							
                          </tr>                                             
                          <?php
                           }
                          ?>   
                                     
                      </tbody>
                    </table>
                   
        </td>
                </tr>                 
                  <?php  }else{ ?>
                  <tr >
                    <td align="center">
                         <div class="col-lg-6 alert alert-danger" style="clear:right; float:none">
                            No records found.
                         </div>   
                    </td>
                  </tr>
                 <?php } ?>                  
              </table>   
<?php
$filename = "JPCMemberList-".date("dmY").".xls";
header( "Content-Type: application/vnd.ms-excel" );
header("Content-Disposition: attachment; filename=$filename");
header("Pragma: no-cache");
header("Expires: 0");
ob_flush();
?>