Viewing file: ExcelRepFormAList.php (8.72 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 */
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 = "formaoffice"; // ปกติ ชื่อ Table เป็นตัวอักษรตัวใหญ่ --> ( FormAoffice )
$myTable3 = "budget_year_tb";
$myTable2PK = "codeId";
/** Table --> personal_tb */
$query1 = " SELECT * FROM $myTable1 WHERE Username='$Username' ";
$result1 = $dbObj->execQuery($query1);
$rs1 = $dbObj->fetchObject($result1);
$Teacher_code = $rs1->Teacher_code;
$query3 = " SELECT * FROM $myTable3 ";
$result3 = $dbObj->execQuery($query3);
$rs3 = $dbObj->fetchObject($result3);
/** Paging */
$page = $_GET['page'];
if( $page == "" ) { $page = 1; }
/** จำนวนข้อมูล ต่อ 1 หน้า */
$perpage = $_REQUEST['perpage'];
if( $perpage == "" ) { $perpage =60; }
} # 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>
<link href="../css/default.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="../js/utilities.js"></script>
</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 ก่อน */
$query = " SELECT * FROM $myTable2 Where Flag='$Flag' And maNo ='$maNo' ";
$result = $dbObj->execQuery($query);
$numrows = $dbObj->_numrows;
/** Paging */
$display = ( !isset ($_GET['page']) ) ? 1 : $_GET['page'];
$start = ( ($display * $limit) - $limit );
/** Paging */
// if( isset($_GET['OrderBy']) ) {
// $query = " SELECT * FROM $myTable2 Where Flag='$Flag' GROUP BY maNo ORDER BY $OrderBy $ASCDESC ";
// }
// elseif( !isset($_GET['OrderBy']) ) {
// $query = " SELECT * FROM $myTable2 Where Flag='$Flag' GROUP BY maNo ORDER BY $myTable2PK DESC ";
// }
$query .= " LIMIT $start, $limit ";
$result = $dbObj->execQuery($query);
?>
<fieldset>
<table width="780" border="0" cellspacing="0" cellpadding="0">
<form id="myForm" name="myForm" method="post" action=" <?=$PHP_SELF;?>?page=<?=$page;?>&Flag=<?=$Flag;?>">
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="center"><?php if( $numrows > 0 ) { ?>
<table width="778" border="0" align="center" cellpadding="0" cellspacing="0" class="BORDER-GREY">
<tr bgcolor="#F8F8F8">
<td width="42" height="25" align="center" bgcolor="#F8F8F8" class="BORDER-RIGHT"><strong>ลำดับ</strong></td>
<td width="391" align="center" bgcolor="#F8F8F8"><strong>รายชื่อผู้ขออนุมัติเดินทางไปราชการ</strong></a></td>
<td width="49" align="center" class="BORDER-LEFT">ข้อแผน</td>
<td width="67" align="center" class="BORDER-LEFT">จำนวนเงิน</td>
<td width="173" align="center" bgcolor="#F8F8F8" class="BORDER-LEFT"><?php
$myOrderCode = "Date_start";
if($OrderBy==$myOrderCode) {
if($ASCDESC=="ASC") {
?>
<img src="../images/controlpage/desc_order.gif" width="7" height="7">
<?php
}
if($ASCDESC=="DESC") {
?>
<img src="../images/controlpage/asc_order.gif" width="7" height="7">
<?php
}
}
?><a href="<?=$PHP_SELF;?>?page=<?=$page;?>&OrderBy=<?=$myOrderCode;?>&ASCDESC=<?=$ASCDESC;?>&perpage=<?=$perpage;?>&Teacher_code=<?=$Teacher_code;?>"><strong>วันที่ไปราชการ</strong></a></td>
</tr>
<?php
$no = 1+($display-1)*$limit;
while( $row = $dbObj->fetchArray($result) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr bgcolor="<?=$bgColor;?>" onmouseover="this.style.backgroundColor='#F5F9F9'" onmouseout="this.style.backgroundColor=''">
<td height="22" align="center" class="BORDER-TOP-RIGHT"><span class="BORDER-TOP">
<?=$no;?>
</span></td>
<td align="left" class="PADDING-LEFT-5 BORDER-TOP"><span class="BORDER-TOP BORDER PADDING">
<?=$row[maNo];?>
</a> <a href="javascript:;" onclick="NewWindow('DetailFormPerson.php?Training_code=<?=$row[Training_code];?>&codeId=<?=$row[codeId];?>&Teacher_code=<?php echo $row[Teacher_code];?>&ProjectId=<? echo $row[ProjectId];?>','RepPlaning','800','600','yes')"><?php
$Teacher_code = $row["Teacher_code"];
$sql = "Select * From $myTable1 Where Teacher_code ='$Teacher_code' ";
$result6 = mysql_query($sql) or die("Error".mysql_error());
$rs6 = mysql_fetch_array($result6);
echo "$rs6[First_name] $rs6[Teacher_name] $rs6[Teacher_lastname]";
?>
</a></span></td>
<td align="center" class="BORDER-TOP BORDER-LEFT PADDING-LEFT-5"><font size="2" face="Tahoma">
<?php
// $sql = "Select * From project_tb Where ProjectId='$row[ProjectId]' AND Teacher_code='$row[Teacher_code]' ";
// $result2 = mysql_query($sql) or die("Error".mysql_error());
// $rs2 = mysql_fetch_array($result2);
// echo "$rs2[Orderlist]";
echo "$row[Orderlist]";
?>
</font></td>
<td align="center" class="BORDER-TOP BORDER-LEFT PADDING-LEFT-5">
<?php
//$sql3 = " SELECT SUM(Budget_use) AS SumB1 FROM project_tb WHERE ProjectId='$row[ProjectId]' And Teacher_code='$row[Teacher_code]' ";
//$result3 = $dbObj->execQuery($sql3);
//$rs3 = $dbObj->fetchArray($result3);
// echo number_format($rs3['SumB1'],2,'.',',');
echo number_format($row['Budget_use'],2,'.',',');
?>
</a></td>
<td align="center" class="BORDER-TOP BORDER-LEFT PADDING-LEFT-5"><?php
$sday = $row['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 = $row['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
$dbObj->freeresult($result);
?>
</table>
<?php } #if ?></td>
</tr>
<tr>
<td> </td>
</tr></form>
</table>
</fieldset></td>
</tr>
</table>
</body>
</html>
<?php
/** Free Resource */
$dbObj->freeresult($result);
/** Close the Database */
$dbObj->disconn();
/** Unset Class */
unset($dbObj);
?>
|