home/abhiramc/public_html/acts.service/export.employee.php 0000644 00000002345 15021152270 0020004 0 ustar 00
getConnection();
if(isset($_POST['export'])){
// initialize object
$empexpo = new employee($db);
// read employee attendance will be here
// query employee attendance
$empexpo->ts_brid = $_POST['offidexpo'];
$stmtexpo = $empexpo->emp_read();
$numexpo = $stmtexpo->rowCount();
$setdata .= "EMP LIST FOR DISTRIBUTION OF CARD\n";
$setdata .= "EMP ID\tEMP NAME\n";
if($numexpo>0){
while ($rowexpo = $stmtexpo->fetch(PDO::FETCH_ASSOC)){
// set up a row for each record
$value = '"' . $rowexpo["empid"] . '"' . "\t";
$value = $value . '"' .$rowexpo["empname"] . '"' . "\n";
$setdata .= $value;
}
}
// if there are no records in the database, display an alert message
else
{
echo "No results to display!";
}
header('Content-Type: application/xls');
header('Content-Disposition: attachment; filename=Employee-barcode-list.xls');
echo $setdata;
}
?>