Viewing file: ExcelShow_Pos_History.php (9.81 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" );
/** Create Database Object */
$dbObj = new DBConn;
//=== SESSION
$Username = $valid_user;
/** Config Table for This Page */
$myTable1 = "personal_tb";
$myTable2 = "history_position_tb";
$myTable2PK = "Date_post";
/** Table --> personal_tb */
$query1 = " SELECT * FROM $myTable1 WHERE Teacher_code='$Teacher_code' ";
$result1 = $dbObj->execQuery($query1);
$rss = $dbObj->fetchArray($result1);
$Teacher_code = $rss['Teacher_code'];
/** Paging */
$page = $_GET['page'];
if( $page == "" ) { $page = 1; }
/** จำนวนข้อมูล ต่อ 1 หน้า */
$perpage = $_REQUEST['perpage'];
if( $perpage == "" ) { $perpage = 1000; }
/** Parameters */
$params = "Teacher_code=$Teacher_code";
/** Searching */
$keyword = $_REQUEST['keyword'];
/** Botton Name Action */
$action = $_REQUEST['action'];
$id = $_REQUEST['id'];
} # 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>
</head>
<body topmargin="0" rightmargin="0" bottommargin="0" leftmargin="0">
<table width="1003" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="800" 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 = $myTable2PK; }
if( !isset($_GET['ASCDESC']) ) { $ASCDESC = "DESC"; }
if( $_GET['ASCDESC'] == "DESC" ) { $ASCDESC = "ASC"; }
elseif( $_GET['ASCDESC'] == "ASC" ) { $ASCDESC = "DESC"; }
/** Query เพื่อหา Numrows ก่อน */
if( $keyword != "" ) {
$query = " SELECT * FROM $myTable2 WHERE Teacher_code='$Teacher_code' AND
( Date_post LIKE '%$keyword%' OR Gover_pos LIKE '%$keyword%' ) ";
}
else {
$query = " SELECT * FROM $myTable2 WHERE Teacher_code='$Teacher_code' ";
}
$result = $dbObj->execQuery($query);
$numrows = $dbObj->_numrows;
/** Paging */
$display = ( !isset ($_GET['page']) ) ? 1 : $_GET['page'];
$start = ( ($display * $limit) - $limit );
/** Paging */
//### Search
if( $keyword != "" ) {
if( isset($_GET['OrderBy']) ) {
$query = " SELECT * FROM $myTable2 WHERE Teacher_code='$Teacher_code' AND
( Date_post LIKE '%$keyword%' OR Gover_pos LIKE '%$keyword%' )
ORDER BY $OrderBy $ASCDESC ";
}
elseif( !isset($_GET['OrderBy']) ) {
$query = " SELECT * FROM $myTable2 WHERE Teacher_code='$Teacher_code' AND
( Date_post LIKE '%$keyword%' OR Gover_pos LIKE '%$keyword%' )
ORDER BY $myTable2PK ASC ";
}
}
else {
if( isset($_GET['OrderBy']) ) {
$query = " SELECT * FROM $myTable2 WHERE Teacher_code='$Teacher_code' ORDER BY $OrderBy $ASCDESC ";
}
elseif( !isset($_GET['OrderBy']) ) {
$query = " SELECT * FROM $myTable2 WHERE Teacher_code='$Teacher_code' ORDER BY $myTable2PK DESC ";
}
}
$query .= " LIMIT $start, $limit ";
$result = $dbObj->execQuery($query);
?>
<table width="780" border="0" cellspacing="0" cellpadding="0">
<form id="myForm" name="myForm" method="post" action="<?=$PHP_SELF;?>?page=<?=$page;?>&<?=$params;?>">
<tr>
<td height="5"></td>
</tr>
<tr>
<td height="372" align="center" valign="top">
<strong>ชื่อ-นามสกุล: <span class="TEXT-CLIMSON10"><?php echo $rss['First_name'] ;?><?php echo $rss['Teacher_name'] ;?> <?php echo $rss['Teacher_lastname'] ;?></span> ตำแหน่งทางราชการปัจจุบัน:<font color="#000000" size="2" face="Tahoma">
<?php
$PositionId = $rss["PositionId"] ;
$sql = "Select * From position_tb Where PositionId='$PositionId' ";
$result2 = mysql_query($sql) or die("Error".mysql_error());
$rss4 = mysql_fetch_array($result2);
echo "$rss4[Position_name] ";
?>
</font></a></strong>
<?php if( $numrows > 0 ) { ?>
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="380" class="PADDING-BOTTOM-5">ทั้งหมด: <strong><?=$numrows;?></strong> รายการ</td>
<td width="380" align="right" class="PADDING-BOTTOM-5"> </td>
</tr>
</table>
<table width="775" border="0" cellspacing="0" cellpadding="0" class="BORDER-TOP-LEFT-RIGHT">
<tr>
<td height="30" align="left" bgcolor="#FFFFFF"> </td>
</tr>
</table>
<table width="767" border="1" align="center" cellpadding="0" cellspacing="0" class="BORDER-GREY">
<tr bgcolor="#F8F8F8">
<td width="25" height="25" align="center"><strong>ID</strong></td>
<td width="85" align="center" class="BORDER-LEFT-RIGHT"><strong>วันที่บังคับใช้</strong></a></td>
<td width="79" align="center"><strong>เลขที่ตำแหน่ง</strong></a></td>
<td width="181" align="center" class="BORDER-LEFT"><strong>ตำแหน่งทางราชการ</strong></td>
<td width="42" align="center" class="BORDER-LEFT"><strong>ระดับ</strong></a></td>
<td width="70" align="center" class="BORDER-LEFT"><strong>เงินเดือน</strong></a></td>
<td width="188" align="center" class="BORDER-LEFT"><strong>คำสั่ง</strong></a></td>
<td align="center" class="BORDER-LEFT">สถานะ</span></td>
</tr>
<?php
$no = 1+($display-1)*$limit;
while( $rs = $dbObj->fetchArray($result) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
if( $keyword != "" ) {
$Date_post = eregi_replace( $keyword, "<font color=red>\\0</font>", $rs['Date_post'] );
$Gover_pos = eregi_replace( $keyword, "<font color=red>\\0</font>", $rs['Gover_pos'] );
}
else {
$Date_post = $rs['Date_post'];
$Gover_pos = $rs['Gover_pos'];
}
?>
<tr bgcolor="<?=$bgColor;?>" onmouseover="this.style.backgroundColor='#F5F9F9'" onmouseout="this.style.backgroundColor=''">
<td height="21" align="center" class="BORDER-TOP"><?=$no;?></td>
<td align="center" class="BORDER-TOP-LEFT-RIGHT"><?php
$dday = $rs['Date_post'];
$yearthai = explode("-",$dday);
$day = intval($yearthai[2]);
$month = intval($yearthai[1]);
$year = intval($yearthai[0]);
// $yearthai = $day ;
$m = getThaiSubMonth($month);
echo "$day"." "."$m"." "."$year";
?></td>
<td align="center" class="BORDER-TOP"><?=$rs['Position_id'];?></td>
<td align="left" class="PADDING-LEFT-5 BORDER-TOP-LEFT"><?=$Gover_pos;?></td>
<td align="center" class="BORDER-TOP-LEFT"><?php if( $rs['Level'] != "" ) echo $rs['Level']; else echo " ";?></td>
<td align="right" class="BORDER-TOP-LEFT PADDING-RIGHT-5"><?php echo number_format($rs['Salary'],2,'.',',');?></td>
<td align="left" class="PADDING-LEFT-5 BORDER-TOP-LEFT"><?php if( $rs['Order_id'] != "" ) echo $rs['Order_id']; else echo " ";?></td>
<td width="40" align="center" class="PADDING-LEFT-5 BORDER-TOP-LEFT">
<?php if( $rs['Flag'] != "" ) echo $rs['Flag']; else echo " ";?>
</span></td>
</tr>
<?php
$no++;
} # while
//$dbObj->freeresult($result);
?>
</table>
<?php } else { #if ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="150" align="center"><span class="TEXT-RED10"><strong>ไม่พบรายการข้อมูล</strong></span><br />
<span class="TEXT-DARK-BLUE10"><br />
กรุณาเลือกทำรายการใหม่</span><br />
<br />
<input type="button" name="button" id="button" value="« ย้อนกลับ" onclick="window.history.back();" /></td>
</tr>
</table>
<?php } # else ?></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
/** Free Resource */
$dbObj->freeresult($result);
$dbObj->freeresult($result1);
/** Close the Database */
$dbObj->disconn();
/** Unset Class */
unset($dbObj);
?>
|