Viewing file: DetailAbsent_01.php (25.98 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" );
require_once( "../include/FunctionDB.php" );
/** Create Database Object */
$dbObj = new DBConn;
/** Config Table for This Page */
$myTable = "personal_tb";
$myTable2 = "history_absent_tb";
$myTable1 = "budget_year_tb";
$query = "SELECT *, prefixName as First_name FROM personal_tb
LEFT JOIN prefix ON personal_tb.First_name = prefix.prefixId
LEFT JOIN position_tb ON personal_tb.PositionId = position_tb.PositionId
LEFT JOIN faculty_tb ON personal_tb.Faculty_code = faculty_tb.Faculty_code
LEFT JOIN district ON personal_tb.districtId = district.districtId
LEFT JOIN amphur ON personal_tb.amphurId = amphur.amphurId
LEFT JOIN province ON personal_tb.provinceId = province.provinceId
WHERE personal_tb.Teacher_code='".$_REQUEST['Teacher_code']."'";
$result = $dbObj->execQuery($query);
$rss = $dbObj->fetchArray($result);
$query1 = " SELECT * FROM $myTable1 ";
$result1 = $dbObj->execQuery($query1);
$rs = $dbObj->fetchObject($result1);
$query2 = " SELECT * FROM $myTable2 WHERE code='$code' ";
$result2 = $dbObj->execQuery($query2);
$rs1 = $dbObj->fetchArray($result2);
$query2 = " SELECT * FROM $myTable2 Where Teacher_code='$rss[Teacher_code]' and Year='$Year' ";
$result2 = $dbObj->execQuery($query2);
$rs2 = $dbObj->fetchObject($result2);
$query2 = " SELECT * FROM $myTable2 WHERE Teacher_code='$Teacher_code' ORDER BY Date_finish DESC ";
$result2 = $dbObj->execQuery($query2);
$rs3 = $dbObj->fetchArray($result2);
} # 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>
<script language="javascript">
function checkData() {
var formObj = document.myForm;
if( (formObj.No_in.value == "" ) && (formObj.Day.value == "" ) ) { alert("กรุณากรอกข้อมูลให้ครบด้วยค่ะ" ); formObj.No_in.style.backgroundColor='#F1F9FC'; formObj.No_in.focus(); return false; }
else if(formObj.No_in.value == "" ) { alert("กรุณากรอก เลขที่หนังสือ"); formObj.No_in.style.backgroundColor='#F1F9FC'; formObj.No_in.focus(); return false;}
else if(formObj.Day.value == "" ) { alert("กรุณากรอก จำนวนวัน"); formObj.Day.style.backgroundColor='#F1F9FC'; formObj.Day.focus(); return false;}
else if(formObj.Year_std.value == "" ) { alert("กรุณากรอก ปีงบประมาณ"); formObj.Year_std.style.backgroundColor='#F1F9FC'; formObj.Year_std.focus(); return false;}
else return true ;
}
</script>
<style type="text/css">
<!--
.style11 {font-size: 14px;
font-family: Tahoma;
}
-->
</style>
</head>
<body topmargin="0" rightmargin="0" bottommargin="0" leftmargin="0">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="800" height="440" align="center" valign="top" style="padding:10px 0px 5px 10px">
<table width="701" border="0" cellspacing="0" cellpadding="0">
<form id="myForm" name="myForm" method="post" action="InsertAbsent.php" onSubmit="return checkData();">
<tr>
<td width="701" align="center">
<table width="667" cellpadding="0" cellspacing="0">
<tr height="31">
<td height="31" width="149"> </td>
<td width="98"> </td>
<td colspan="3"><strong>แบบใบลาป่วย ลาคลอดบุตร ลากิจส่วนตัว</strong></td>
<td width="4"> </td>
</tr>
<tr height="29">
<td height="29" colspan="6">ส่วนราชการ</a>
<?php
$collegeCode = $rss["collegeCode"];
$sql = "Select * From college Where collegeStatus ='1'";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rs2 = mysql_fetch_array($result1);
echo "$rs2[collegeName] ";
?>
</a></td>
</tr>
<tr height="29">
<td height="29" colspan="3" align="left">ที่ </a>
<input type="text" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" value="<? echo $rs1['AbsentNo'];?>" size="15" />
</a></td>
<td> </td>
<td>วันที่</a> </a>
<input name="Date2" type="text" id="Date2" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" size="10" value=" <?php
$sday = $rs1[Date];
$yearthai = explode("-",$sday);
$day = intval($yearthai[2]);
$month = intval($yearthai[1]);
$year = intval($yearthai[0]);
//////////////////
// $yearthai = $day ;
$m = getThaiSubMonth($month);
echo"$day"." "."$m"." "."$year";
?>" />
</font></td>
<td> </td>
</tr>
<tr height="29">
<td height="29" colspan="3" align="left">เรื่อง </a>
<input name="Date_finish3" type="text" id="Date_finish3" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" value=" <? $Absent_code = $rs1['Absent_code'];
$sql3 = " Select * From history_absent Where Absent_code='$Absent_code' ";
$result3 = $dbObj->execQuery($sql3);
$rs3 = $dbObj->fetchArray($result3);
echo $rs3['Absent_type']; ?> " size="10" />
</a></td>
<td width="42"> </td>
<td width="248"> </td>
<td> </td>
</tr>
<tr height="29">
<td height="29" colspan="5" align="left">เรียน ผู้อำนวยการ </a>
<?php
$collegeCode = $rss["collegeCode"];
$sql = "Select * From college Where collegeStatus ='1'";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rs2 = mysql_fetch_array($result1);
echo "$rs2[collegeName] ";
?>
</a></td>
<td> </td>
</tr>
<tr height="29">
<td height="25"> </td>
<td colspan="5" align="left">ข้าพเจ้า.</a>
<input name="Name" type="text" id="Name" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" size="30" value="<? echo $rss[First_name]?> <? echo $rss[Teacher_name]?> <? echo $rss[Teacher_lastname]?> " />
</a> ตำแหน่ง.</a>
<input name="Name2" type="text" id="Name2" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" size="30" value=" <? $PositionId = $rss["PositionId"];
$sql = "Select * From position_tb Where PositionId ='$PositionId' ";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rs2 = mysql_fetch_array($result1);
echo "$rs2[Position_name] ";?>
" />
</a></td>
</tr>
<tr height="29">
<td height="29" colspan="6" align="left">สังกัด</a>
<input name="Name3" type="text" id="Name3" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" size="20" value="<?php $Faculty_code = $rss["Faculty_code"];
$sql = "Select * From faculty_tb Where Faculty_code='$Faculty_code'";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rs2 = mysql_fetch_array($result1);
echo "$rs2[Faculty_name] "; ?>" />
</a>
<input name="Name3" type="text" id="Name4" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" size="40" value="<?php
$collegeCode = $rss["collegeCode"];
$sql = "Select * From college Where collegeStatus ='1'";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rs2 = mysql_fetch_array($result1);
echo "$rs2[collegeName] "; ?> " />
</a>สถาบันพระบรมราชชนก</a></td>
</tr>
<tr height="29">
<td height="29" align="left"> </td>
<td height="29" align="left"><label>
<input name="Absent_code" type="radio" <?php if (!(strcmp("$rs1[Absent_code]","2"))) {echo "checked";} ?> value="2" disabled="disabled" />
ลาป่วย
</label></td>
<td height="29" align="left"> </td>
<td height="29" align="left"> </td>
<td height="29" align="left"> </td>
<td height="29" align="left"> </td>
</tr>
<tr height="29">
<td height="29" align="left"><div align="center">ขอลา </div></td>
<td height="29" align="left"><label>
<input name="Absent_code" type="radio" <?php if (!(strcmp("$rs1[Absent_code]","1"))) {echo "checked";} ?> value="1" disabled="disabled" />
ลากิจ</label></td>
<td height="29" colspan="4" align="left">เนื่องจาก</a>
<input name="Absent_type" type="text" id="Absent_type" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" value="<? echo $rs1[Absent_type] ?>" size="25" />
</a></td>
</tr>
<tr height="29">
<td height="29" align="left"> </td>
<td height="29" align="left"><label>
<input name="Absent_code" type="radio" <?php if (!(strcmp("$rs1[Absent_code]","4"))) {echo "checked";} ?> value="04" disabled="disabled" />
ลาคลอด</label></td>
<td height="29" align="left"> </td>
<td height="29" align="left"> </td>
<td height="29" align="left"> </td>
<td height="29" align="left"> </td>
</tr>
<tr height="29">
<td height="29" align="left">ขอลา ตั้งแต่วันที่</td>
<td height="29" colspan="5" align="left"></a>
<input name="Date_start" type="text" id="Date_start" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" size="10" value=" <?php
$sday = $rs1[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";
?>" />
</a> </a>ถึงวันที่
</a>
<input name="Date_finish" type="text" id="Date_finish" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" size="10" value=" <?php
$sday = $rs1[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";
?>" />
</a>
มีกำหนด</a>
<input name="Absent_times" type="text" id="Absent_times" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" value="<?=$rs1['Absent_times'];?> " size="2" maxlength="2" />
</a>วัน</td>
</tr>
<tr height="29">
<td height="29" colspan="6" align="left">ข้าพเจ้าได้ลา
<label>
<input name="Absent_code" type="checkbox" id="Absent_code" <?php if (!(strcmp("$rs1[Absent_code]","2"))) {echo "checked";} ?> value="2" />
</label>
ป่วย
<label>
<input name="Absent_code" type="checkbox" id="Absent_code" <?php if (!(strcmp("$rs1[Absent_code]","1"))) {echo "checked";} ?> value="1" />
</label>
กิจส่วนตัว
<label>
<input name="Absent_code" type="checkbox" id="Absent_code" <?php if (!(strcmp("$rs1[Absent_code]","4"))) {echo "checked";} ?> value="4" />
</label>
คลอดบุตร ครั้งสุดท้ายตั้งแต่วันที่</a>
<input name="Date_finish2" type="text" id="Date_finish2" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" size="10" value=" <?php
$sday = $rs1[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";
?>" />
</a></td>
</tr>
<tr height="29">
<td height="29" colspan="6" align="left">ในระหว่างลาจะติดต่อข้าพเจ้าได้ที่</a>
<input name="Address" type="text" id="Address" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" value="<?=$rss["Address"];?>" size="60" />
</a></td>
</tr>
<tr height="29">
<td height="29" colspan="6" align="left"> </td>
</tr>
<tr height="29">
<td height="29"> </td>
<td> </td>
<td width="126"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr height="31">
<td height="31"> </td>
<td> </td>
<td> </td>
<td colspan="3" align="left"> <span class="style1">ขอแสดงความนับถือ</span></td>
</tr>
<tr height="29">
<td height="29" colspan="3" align="center">สถิติการลาในปีงบประมาณนี้ </a>
<input name="Budget_Year2" type="text" id="Budget_Year2" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" value="<?=$rs->Budget_year;?>" size="3" maxlength="4" />
</a></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr height="31">
<td height="31" colspan="3" align="left"><table width="296" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<th width="82" height="27" scope="col">ประเภทการลา</th>
<th width="83" align="center" scope="col">ลามาแล้ว</th>
<th width="62" align="center" scope="col">ลาครั้งนี้</th>
<th width="59" align="center" scope="col">รวมเป็น</th>
</tr>
<tr>
<td>ป่วย</td>
<td align="center">
<?php
$Teacher_code = $rss["Teacher_code"];
$sql1 = "Select Sum(Absent_times) as SumB1 From history_absent_tb Where Teacher_code='$Teacher_code' and Year='$Year' and Absent_code='2' and code < '$code' " ;
$result1 = mysql_query($sql1) or die("Erro".mysql_error());
$rss1 = mysql_fetch_array($result1);
echo number_format($rss1[SumB1],1,'.',',');
//echo"$rss1[SumC1]";
?>
</a></td>
<td align="center"><?=$rs1[Absent_code]==2?number_format($rs1['Absent_times'],1,'.',','):"0.0";?></td>
<td align="center"><?=$rs1[Absent_code]==2?number_format(($rss1[SumB1]+$rs1['Absent_times']),1,'.',','):number_format($rss1[SumB1],1,'.',',');?></td>
</tr>
<tr>
<td>กิจส่วนตัว</td>
<td align="center">
<?php
$Teacher_code = $rss["Teacher_code"];
$sql1 = "Select Sum(Absent_times) as SumB1 From history_absent_tb Where Teacher_code='$Teacher_code' and Year='$Year' and Absent_code='1' and code < '$code' " ;
$result1 = mysql_query($sql1) or die("Erro".mysql_error());
$rss1 = mysql_fetch_array($result1);
echo number_format($rss1[SumB1],1,'.',',');
//echo"$rss1[SumC1]";
?>
</a></td>
<td align="center"><?=$rs1[Absent_code]==1?number_format($rs1['Absent_times'],1,'.',','):"0.0";?></td>
<td align="center"><?=$rs1[Absent_code]==1?number_format(($rss1[SumB1]+$rs1['Absent_times']),1,'.',','):number_format($rss1[SumB1],1,'.',',');?></td>
</tr>
<tr>
<td>คลอดบุตร</td>
<td align="center">
<?php
$Teacher_code = $rss["Teacher_code"];
$sql1 = "Select Sum(Absent_times) as SumB1 From history_absent_tb Where Teacher_code='$Teacher_code' and Year='$Year' and Absent_code='4' and code < '$code' " ;
$result1 = mysql_query($sql1) or die("Erro".mysql_error());
$rss1 = mysql_fetch_array($result1);
echo number_format($rss1[SumB1],1,'.',',');
//echo"$rss1[SumC1]";
?>
</a></td>
<td align="center"><?=$rs1[Absent_code]==4?number_format($rs1['Absent_times'],1,'.',','):"0.0";?></td>
<td align="center"><?=$rs1[Absent_code]==4?number_format(($rss1[SumB1]+$rs1['Absent_times']),1,'.',','):number_format($rss1[SumB1],1,'.',',');?></td>
</tr>
</table></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr height="31">
<td height="31" align="left"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr height="31">
<td height="31" align="left"> </td>
<td> </td>
<td> </td>
<td> </td>
<td>(ลงชื่อ)...............................</td>
<td> </td>
</tr>
<tr height="29">
<td height="29"> </td>
<td> </td>
<td> </td>
<td> </td>
<td align="center">(</a> <? echo $rss[First_name]?> <? echo $rss[Teacher_name]?> <? echo $rss[Teacher_lastname]?>)</a></td>
<td> </td>
</tr>
<tr height="31">
<td height="31"> </td>
<td> </td>
<td> </td>
<td colspan="3" align="left"><span class="style2">ความเห็นผู้บังคับบัญชา</span></td>
</tr>
<tr height="29">
<td height="29"></td>
<td></td>
<td> </td>
<td colspan="3" align="center">
<input name="Info_name3" type="text" id="Info_name3" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" size="25" />
</td>
</tr>
<tr height="29">
<td height="29" colspan="3" align="left">ลงชื่อ................................ผู้ตรวจสอบ </td>
<td colspan="2">....................................</td>
<td> </td>
</tr>
<tr height="29">
<td height="29" colspan="2" align="left">ตำแหน่ง................................ </td>
<td align="left"> </td>
<td colspan="3" align="left"> (</a>
<?php
//$Teacher_code = $rss["TeacherId"];
$sql = "Select *, prefixName as First_name FROM personal_tb LEFT JOIN prefix ON personal_tb.First_name = prefix.prefixId Where Faculty_code ='$Faculty_code' and TeacherId='1' ";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rs2 = mysql_fetch_array($result1);
echo "$rs2[First_name]$rs2[Teacher_name] $rs2[Teacher_lastname]";
?>
</a>)
<input name="TeacherId" type="hidden" id="TeacherId" value="<? echo $rs2["Teacher_code"]?>" /></td>
</tr>
<tr height="29">
<td height="29" colspan="3" align="left"> วันที่......../........../.......... </td>
<td colspan="3" align="left">ตำแหน่ง</a>
<input name="Name4" type="text" id="Name5" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" size="25" value=" <? $PositionId = $rs2["PositionId"];
$sql = "Select * From position_tb Where PositionId ='$PositionId' ";
$result1 = mysql_query($sql) or die("Error".mysql_error());
$rs2 = mysql_fetch_array($result1);
echo "$rs2[Position_name] ";?>
" />
</a></td>
</tr>
<tr height="29">
<td height="29"> </td>
<td> </td>
<td> </td>
<td colspan="3" align="left"> วันที่.....เดือน..........พ.ศ........</td>
</tr>
<tr height="29">
<td height="29"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr height="31">
<td height="31"> </td>
<td> </td>
<td> </td>
<td align="left"><div align="center">คำสั่ง</div></td>
<td> </td>
<td> </td>
</tr>
<tr height="29">
<td height="29"> </td>
<td> </td>
<td> </td>
<td align="left"> </td>
<td colspan="2" align="left"><label>
<input type="checkbox" name="checkbox" value="checkbox" />
</label>
อนุญาต
<input type="checkbox" name="checkbox2" value="checkbox" />
ไม่อนุญาต</td>
</tr>
<tr height="29">
<td height="29"> </td>
<td> </td>
<td> </td>
<td>ลงชื่อ</td>
<td colspan="2" align="left">............................................</td>
</tr>
<tr height="29">
<td height="29"> </td>
<td> </td>
<td> </td>
<td colspan="3" align="left"> </td>
</tr>
<tr height="29">
<td height="29"> </td>
<td> </td>
<td> </td>
<td colspan="3" align="left"> </td>
</tr>
<tr height="29">
<td height="29"> </td>
<td> </td>
<td> </td>
<td colspan="3" align="left"> </td>
</tr>
<tr height="29">
<td height="29"> </td>
<td> </td>
<td> </td>
<td colspan="3" align="left"> วันที่........เดือน...............พ.ศ......
.</td>
</tr>
<tr height="31">
<td colspan="6"> </td>
</tr>
<tr height="31">
<td height="31" colspan="6" align="center"> </td>
</tr>
</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);
?>
|