Viewing file: AbsentDetail.php (8.18 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;
/** Config Table for This Page */
$myTable1 = "personal_tb";
$myTable2 = "history_absent_tb";
$Username = $valid_user;
//=== personal_tb
$query1 = " SELECT * FROM $myTable1 WHERE Username='$Username' ";
$result1 = $dbObj->runQuery($query1);
$rs1 = $dbObj->fetchArray($result1);
//=== salary_repot_tb
$query = " SELECT * FROM $myTable2 WHERE Teacher_code='$Teacher_code' AND Absent_code='$Absent_code' AND Year='$Year' ";
$result = $dbObj->execQuery($query);
//$rs = $dbObj->fetchArray($result);
$num = $dbObj->_numrows;
} # 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" />
<link href="../css/default.css" rel="stylesheet" type="text/css" />
<title>รายละเอียดประวัติการลา</title>
</head>
<body>
<table width="615" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10"></td>
</tr>
</table>
<table width="615" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="615" align="center"><fieldset>
<form id="form1" name="form1" method="post" action="">
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10"></td>
</tr>
<tr>
<td height="25" align="center" bgcolor="#F0F0F0"><span class="NOTE">รายละเอียดวันลา</span> <span class="TEXT-HEADER11-BLUE"><strong>
<?php
$query = " SELECT * FROM $myTable2 WHERE Teacher_code='$Teacher_code' AND Absent_code='$Absent_code' AND Year='$Year' ";
$result11 = $dbObj->execQuery($query);
$rs11 = $dbObj->fetchArray($result11);
$Absent_code = $rs11['Absent_code'];
$sql2 = " SELECT * FROM history_absent01_tb WHERE Absent_code='$Absent_code' ";
$result2 = $dbObj->execQuery($sql2);
$rs2 = $dbObj->fetchArray($result2);
echo $rs2['Absent_type'] . $rs2['Teacher_lastname'];
?></strong></span></td>
</tr>
<tr>
<td height="5"></td>
</tr>
</table>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="BORDER-GREY">
<tr bgcolor="#F8F8F8">
<td width="45" height="25" align="center"><strong>No</strong></td>
<td width="95" align="center" class="BORDER-LEFT-RIGHT"><strong>ปีงบประมาณ</strong></td>
<td width="115" align="center" class="BORDER-LEFT"><strong>วัน เดือน ปี ที่ลา</strong></td>
<td width="115" align="center" class="BORDER-LEFT"><strong>ถึง วัน เดือน ปี</strong></td>
<td width="115" align="center" class="BORDER-LEFT"><strong>ประเภทวันลา</strong></td>
<td width="115" align="center" class="BORDER-LEFT"><strong>จำนวนวันที่ลา</strong></td>
</tr>
<?php
$no = 1+($display-1)*$limit;
while( $rs = $dbObj->fetchArray($result) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr bgcolor="<?=$bgColor;?>" onmouseover="this.style.backgroundColor='#F5F9F9'" onmouseout="this.style.backgroundColor=''">
<td height="23" align="center" class="BORDER-TOP"><?=$no;?></td>
<td align="center" class="PADDING-LEFT-5 BORDER-TOP BORDER-LEFT"><?=$rs['Year'];?></td>
<td align="center" class="BORDER-TOP BORDER-LEFT"><?php
$sday = $rs['Date_start'];
$yearthai = explode("-",$sday);
$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 BORDER-LEFT"><?php
$sday = $rs['Date_finish'];
$yearthai = explode("-",$sday);
$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 BORDER-LEFT"><?php echo number_format($rs['Costt_to'],2,'.',',');?></td>
<td align="center" class="BORDER-TOP BORDER-LEFT"><?php echo number_format($rs['Absent_times'],2,'.',','); ?></td>
</tr>
<?php
$no++;
} # while
$dbObj->freeresult($result);
?>
<tr bgcolor="<?=$bgColor;?>" onmouseover="this.style.backgroundColor='#F5F9F9'" onmouseout="this.style.backgroundColor=''">
<td height="23" colspan="5" align="right" class="PADDING-RIGHT-5 BORDER-TOP" style="border-top:double 1px outset #CCCCCC">รวมจำนวนวันที่ใช้ไป</td>
<td align="center" class="BORDER-TOP BORDER-LEFT" style="border-top:double 1px outset #CCCCCC"><?php
$sql3 = " SELECT SUM( Absent_times ) AS SumB1 FROM history_absent_tb
WHERE Year='$Year' AND Teacher_code='$Teacher_code' AND Absent_code='$Absent_code' ";
$result3 = $dbObj->execQuery($sql3);
$rs3 = $dbObj->fetchArray($result3);
echo number_format($rs3['SumB1'],2,'.',',');
?></td>
</tr>
<tr bgcolor="<?=$bgColor;?>" onmouseover="this.style.backgroundColor='#F5F9F9'" onmouseout="this.style.backgroundColor=''">
<td height="23" colspan="5" align="right" class="PADDING-RIGHT-5 BORDER-TOP">วันลาตามสิทธิ์</td>
<td align="center" class="BORDER-TOP BORDER-LEFT" style="border-top:double 1px outset #CCCCCC"><?php
$sql4 = " SELECT * FROM personal_tb WHERE Teacher_code='$Teacher_code' ";
$result4 = $dbObj->execQuery($sql4);
$rs4 = $dbObj->fetchArray($result4);
echo number_format($rs4['Absent_01'],2,'.',',');
?></td>
</tr>
<tr bgcolor="<?=$bgColor;?>" onmouseover="this.style.backgroundColor='#F5F9F9'" onmouseout="this.style.backgroundColor=''">
<td height="23" colspan="5" align="right" class="PADDING-RIGHT-5 BORDER-TOP">คงเหลือวันลา</td>
<td align="center" class="BORDER-TOP BORDER-LEFT" style="border-top:double 1px outset #CCCCCC"><?php
$Delete3 = $rs4['Absent_01'] - $rs3['SumB1'] ;
echo number_format($Delete3,2,'.',',');
// echo"$Del4";
?></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center">ทั้งหมด <span class="NOTE"><?=$num;?></span> รายการ</td>
</tr>
</table>
</form>
</fieldset>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"></td>
</tr>
</table>
<input type="button" name="close" value="ปิดหน้าต่าง" onclick="window.close()" class="CURSOR-HAND" />
</td>
</tr>
</table>
</body>
</html>
<?php
/** Free Resource */
$dbObj->freeresult($result1);
/** Close the Database */
$dbObj->disconn();
/** Unset Class */
unset($dbObj);
?>
|