Viewing file: ExcelAcademicYear.php (9.52 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
session_start();
/** Define Validate Access */
define( '_VALID_ACCESS', 1 );
/** Check Session User Login */
if( !session_is_registered("valid_user") && !session_is_registered("Priority") ) {
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-874\" />";
echo "<p style=padding-top:115px><p align=center><br /><font color=red><strong>กรุณาทำการ Login ก่อน</strong></font></p></p>";
echo "<meta http-equiv=\"refresh\" content=\"1; URL=../login.php\" />";
exit();
}
else {
/** Configuration */
header('Content-type: application/xls');
header('Content-Disposition: attachment; filename="testing.xls"');
require_once( "../configuration.php" );
require_once( $_Config_absolute_path . "/includes/framework.php" );
require_once( "../include/Function.php" );
/** Chart */
include ("../includes/charts.php");
/** Create Database Object */
$dbObj = new DBConn;
$sql3 = "Select Teacher_code,First_name,Teacher_name,Teacher_lastname,Faculty_code From personal_tb Where Teacher_code='$Teacher_code'";
$result2= mysql_query($sql3);
$rss = mysql_fetch_array($result2);
/** Config Table for This Page */
$myTable = "research_tb";
$myTable2PK = "Research_code";
$myOrderBy = "Year_finish";
$myTableField1 = "Research_name";
$myTableField2 = "Branch";
/** Parameters */
$params = " academic_year_finish=$academic_year_finish";
/** Paging */
$page = $_GET['page'];
if( $page == "" ) { $page = 1; }
/** จำนวนข้อมูล ต่อ 1 หน้า */
$perpage = $_REQUEST['perpage'];
if( $perpage == "" ) { $perpage = 200; }
} # else
?>
<!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>ข้อมูลงานวิจัยแยกตามรายบุคคล</title>
<style type="text/css">
<!--
.style1 {color: #000000}
-->
</style>
</head>
<body topmargin="0" rightmargin="0" bottommargin="0" leftmargin="0">
<table width="1051" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1051" height="440" align="center" valign="top" style="padding:10px 0px 5px 10px">
<?php
/** Config Paging */
if( $perpage == "" ) { $limit = $_Config_limit; }
else { $limit = $perpage; }
$scroll = $_Config_scroll;
/** ตั้งค่า Default สำหรับการทำ Order By */
if( $OrderBy == "" ) { $OrderBy = $myOrderBy; }
if( !isset($_GET['ASCDESC']) ) { $ASCDESC = "ASC"; }
if( $_GET['ASCDESC'] == "ASC" ) { $ASCDESC = "DESC"; }
elseif( $_GET['ASCDESC'] == "DESC" ) { $ASCDESC = "ASC"; }
/** Query เพื่อหา Numrows ก่อน */
if( $keyword != "" ) { // ใส่ Keyword
$query = " SELECT * FROM $myTable WHERE academic_year_finish='$academic_year_finish' ";
} else {
$query = " SELECT * FROM $myTable where academic_year_finish='$academic_year_finish'";
}
$result = $dbObj->execQuery($query);
$numrows = $dbObj->_numrows;
/** Paging */
$display = ( !isset ($_GET['page']) ) ? 1 : $_GET['page'];
$start = ( ($display * $limit) - $limit );
/** Paging */
if( isset($_GET['OrderBy']) ) {
if( $keyword != "" ) { // ใส่ Keyword
$query = " SELECT * FROM $myTable
WHERE academic_year_finish='$academic_year_finish' ORDER BY $OrderBy $ASCDESC ";
} else {
$query = " SELECT * FROM $myTable where academic_year_finish='$academic_year_finish' ORDER BY $OrderBy $ASCDESC ";
}
}
elseif( !isset($_GET['OrderBy']) ) {
if( $keyword != "" ) { // ใส่ Keyword
$query = " SELECT * FROM $myTable
WHERE academic_year_finish='$academic_year_finish' ORDER BY $OrderBy $ASCDESC ";
} else {
$query = " SELECT * FROM $myTable where academic_year_finish='$academic_year_finish' ORDER BY $OrderBy $ASCDESC ";
}
}
$query .= " LIMIT $start, $limit ";
$result = $dbObj->execQuery($query);
?>
<table width="992" border="0" align="center" cellpadding="0" cellspacing="0">
<form id="myForm" name="myForm" method="post" action="<?=$PHP_SELF;?>?page=<?=$page;?>">
<tr>
<td width="992" height="5"></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td height="115" align="center" valign="top">
<table width="970" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" style="padding-bottom:10px;"><strong>ปี การศึกษา. :
<?=$academic_year_finish ;?>
</strong></td>
</tr>
</table>
<?php // if( $numrows > 0 ) { ?>
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
</tr>
</table>
<table width="974" border="1" align="center" cellpadding="0" cellspacing="0" class="BORDER-GREY">
<tr bgcolor="#F8F8F8">
<td width="38" height="25" align="center"><strong>ลำดับ</strong></td>
<td width="419" align="center" bgcolor="#F8F8F8" class="BORDER-LEFT"><strong> ชื่อผลงานการวิจัย </strong></td>
<td width="77" align="center" bgcolor="#F8F8F8" class="BORDER-LEFT"><span class="TEXT-DARK-BLUE10">ปีงบประมาณ</span></td>
<td width="97" align="center" bgcolor="#F8F8F8" class="BORDER-LEFT"><span class="TEXT-DARK-BLUE10">ปีการศึกษา</span></td>
<td width="87" align="center" bgcolor="#F8F8F8" class="BORDER-LEFT"><span class="TEXT-DARK-BLUE10">วัน/เดือน/ปี <br />ที่เริ่ม</span></td>
<td width="85" align="center" bgcolor="#F8F8F8" class="BORDER-LEFT"><span class="TEXT-DARK-BLUE10">วัน/เดือน/ปี <br />ที่แล้วเสร็จ</span></td>
<td width="99" align="center" bgcolor="#F8F8F8" class="BORDER-LEFT"><span class="TEXT-DARK-BLUE10">วัน/เดือน/ปี <br />ที่เผยแพร่</span></td>
<td width="90" align="center" bgcolor="#F8F8F8" class="BORDER-LEFT"><span class="TEXT-DARK-BLUE10">ปี พ.ศ</span></td>
<td width="90" align="center" bgcolor="#F8F8F8" class="BORDER-LEFT"><span class="TEXT-DARK-BLUE10">แหล่งเงินทุน <br />ภายใน</span></td>
<td width="90" align="center" bgcolor="#F8F8F8" class="BORDER-LEFT"><span class="TEXT-DARK-BLUE10">แหล่งเงินทุน <br />
ภายนอก</span></td>
<td width="90" align="center" bgcolor="#F8F8F8" class="BORDER-LEFT">รวมทั้งหมด</td>
</tr>
<?php
$no = 1+($display-1)*$limit;
while( $rs = $dbObj->fetchArray($result) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
$sql = " SELECT * FROM research_tb WHERE Research_code ='$rs[Research_code]' ";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rss1= mysql_fetch_array($result1);
?>
<tr bgcolor="<?=$bgColor;?>" onmouseover="this.style.backgroundColor='#F5F9F9'" onmouseout="this.style.backgroundColor=''">
<td height="23" align="center" class="BORDER-TOP"><?=$no;?></td>
<td align="left" class="BORDER-TOP-LEFT "><?php echo $rs['Research_name']; ?></a></td>
<td align="center" class="BORDER-TOP-LEFT "><? echo $rss1['fiscal_year_finish']; ?></td>
<td align="center" class="BORDER-TOP-LEFT "><? echo $rss1['academic_year_finish']; ?></td>
<td align="center" class="BORDER-TOP-LEFT "><?php
$sday = $rss1['Year_start'];
$yearthai = explode( "-", $sday );
$day = intval( $yearthai[2] );
$month = intval( $yearthai[1] );
$year = intval( $yearthai[0] );
$m = getThaiSubMonth( $month );
echo $day ." ". $m ." ". $year;
?></td>
<td align="center" class="BORDER-TOP-LEFT "><?php
$sday = $rss1['Year_finish'];
$yearthai = explode( "-", $sday );
$day = intval( $yearthai[2] );
$month = intval( $yearthai[1] );
$year = intval( $yearthai[0] );
$m = getThaiSubMonth( $month );
echo $day ." ". $m ." ". $year;
?></td>
<td align="center" class="BORDER-TOP-LEFT "><?php
$sday = $rss1['Year_sprop'];
$yearthai = explode( "-", $sday );
$day = intval( $yearthai[2] );
$month = intval( $yearthai[1] );
$year = intval( $yearthai[0] );
$m = getThaiSubMonth( $month );
echo $day ." ". $m ." ". $year;
?></td>
<td align="center" class="BORDER-TOP-LEFT "><? echo $rss1['Year_prop']; ?></td>
<td align="center" class="BORDER-TOP-LEFT "><? echo $rss1['FundIn'];?></td>
<td align="center" class="BORDER-TOP-LEFT "><? echo $rss1['FundOut'];?></td>
<td align="center" class="BORDER-TOP-LEFT "><? echo $rss1['FundUse'];?></td>
</tr>
<?php
$no++;
} # while
$dbObj->freeresult($result);
?>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr></form>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
/** Free Resource */
$dbObj->freeresult($result);
/** Close the Database */
$dbObj->disconn();
/** Unset Class */
unset($dbObj);
?>
|