Viewing file: SearchTraningListToExcel.php (3.95 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
$filename ="report_".(($_REQUEST['dateStart'])?$_REQUEST['dateStart']:date("d/m/Y"))."-".(($_REQUEST['dateFinish'])?$_REQUEST['dateFinish']:date("d/m/Y")).".xls";
header('Content-type: application/xls');
header('Content-Disposition: attachment; filename='.$filename);
/** Define Validate Access */
define( '_VALID_ACCESS', 1 );
/** Configuration */
include( "../configuration.php" );
require_once( $_Config_absolute_path . "/includes/framework.php" );
require_once( $_Config_absolute_path . "/include/Function.php" );
/** Create Database Object */
$dbObj = new DBConn;
//$query = " SELECT * FROM formaoffice , personal_tb WHERE personal_tb.Teacher_code = formaoffice.Teacher_code AND formaoffice.Date_start >= '".dmyE2ymdT($_REQUEST['dateStart'])."' AND formaoffice.Date_finish <= '".dmyE2ymdT($_REQUEST['dateFinish'])."' ";
$query = " SELECT *, prefixName as First_name FROM formaoffice
LEFT JOIN personal_tb ON formaoffice.Teacher_code = personal_tb.Teacher_code
LEFT JOIN prefix ON personal_tb.First_name = prefix.prefixId
WHERE formaoffice.Date_start >= '".dmyE2ymdT($_REQUEST['dateStart'])."' AND formaoffice.Date_finish <= '".dmyE2ymdT($_REQUEST['dateFinish'])."' ";
$result = $dbObj->execQuery($query);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<!--<title><?=$_Config_sitename;?> - ¢éÍÁÙŧҹÊÒúÃó - ¢éÍÁÙÅÃÒ¡ÒÃ˹ѧÊ×ÍÃѺ-Êè§</title>
<script type="text/javascript" src="./js/utilities.js"></script>
<script type="text/javascript" src="./js/calendarDateInput2.js"></script>
<link href="./css/default.css" rel="stylesheet" type="text/css" />-->
</head>
<body>
<table width="816" border="1" align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="#F0F0F0">
<td height="31" colspan="4" align="center"><strong>¢éÍÁÙÅ¡ÒÃä»ÃÒª¡Òà µÑé§áµèÇѹ·Õè <?=($_REQUEST['dateStart'])?dmyE2dmyT($_REQUEST['dateStart']):dmyE2dmyT(date("d/m/Y"));?> ¶Ö§Çѹ·Õè <?=($_REQUEST['dateFinish'])?dmyE2dmyT($_REQUEST['dateFinish']):dmyE2dmyT(date("d/m/Y"));?></strong></td>
</tr>
<tr bgcolor="#F0F0F0">
<td width="30" height="25" align="center"><strong>No</strong></td>
<td width="168" align="center"><strong>ª×èÍ</strong></td>
<td width="433" align="center"><strong>àÃ×èͧ</strong></td>
<td width="175" align="center"><strong>ÃÐËÇèÒ§Çѹ·Õè</strong></td>
</tr>
<?php
$no = 1+($display-1)*$limit;
while( $rs = $dbObj->fetchArray($result) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr>
<td height="23" align="center"><?=$no;?></td>
<td align="left"><?php echo " $rs[First_name] $rs[Teacher_name] $rs[Teacher_lastname]";?></td>
<td align="left"><?php if( $rs['Training_name'] != "" ) echo $rs['Training_name']; else echo " "; ?></td>
<td align="center"><?php
$sday = $rs['Date_start'];
$yearthai = explode("-",$sday);
$day = intval($yearthai[2]);
$month = intval($yearthai[1]);
$year = intval($yearthai[0]);
$m = getThaiSubMonth($month);
echo "$day"." "."$m"." "."$year";
?>
-
<?php
$sday = $rs['Date_finish'];
$yearthai = explode("-",$sday);
$day = intval($yearthai[2]);
$month = intval($yearthai[1]);
$year = intval($yearthai[0]);
$m = getThaiSubMonth($month);
echo "$day"." "."$m"." "."$year";
?></td>
</tr>
<?php
$no++;
} # while
?>
</table>
</body>
</html>
<?php
/** Free Resource */
$dbObj->freeresult($result);
/** Close the Database */
$dbObj->disconn();
/** Unset Class */
unset($dbObj);
?>
|