Viewing file: AddAbsent_01.php (24.13 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 */
$myTable = "personal_tb";
$myTable1 = "budget_year_tb";
$myTable2 = "history_absent_tb";
$myTable3 ="history_absent ";
$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 Teacher_code='$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);
$rs1 = $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" src="../js/calendarDateInput2.js"></script>
<script language="javascript" src="../js/ajaxScript.js"></script>
<script language="javascript" type="text/javascript">
function confirmSubmit() {
var formObj = document.form1;
if( (formObj.Absent_type.value == "" ) && (formObj.Absent_times.value == "" ) ) { alert("กรุณากรอกข้อมูลให้ครบด้วยค่ะ" ); formObj.Absent_type.style.backgroundColor='#F1F9FC'; formObj.Absent_times.focus(); return false; }
if(formObj.Absent_type.value == "" ) { alert("กรุณากรอก สาเหตุการลา"); formObj.Absent_type.style.backgroundColor='#F1F9FC'; formObj.Absent_type.focus(); return false;}
if(formObj.Absent_times.value == "" ) { alert("กรุณากรอก จำนวนวัน"); formObj.Absent_times.style.backgroundColor='#F1F9FC'; formObj.Absent_times.focus(); return false;}
if(formObj.Year.value == "" ) { alert("กรุณากรอก ปีงบประมาณ"); formObj.Year.style.backgroundColor='#F1F9FC'; formObj.Year.focus(); return false;}
else return true ;
}
</script>
</head>
<body topmargin="0" rightmargin="0" bottommargin="0" leftmargin="0">
<?php
include("../templates/incHeader.php");
?>
<table width="1003" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="203" align="left" valign="top" style="padding:10px 0px 0px 5px"><?php include("./_incMainMenu.php");?></td>
<td width="800" height="440" align="left" valign="top" style="padding:10px 0px 5px 10px"><fieldset><legend><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><a href="index.php">หน้าหลัก</a></font><img src="../picture/ico3.gif" width="10" height="10" align="absmiddle" border="0" /></font><a href="Menu_Form.php?Teacher_code=<?=$Teacher_code;?>">แบบฟอร์มราชการ</a></font><img src="../picture/ico3.gif" width="10" height="10" align="absmiddle" border="0" /></font><a href="FormAbsentList.php?Teacher_code=<?=$Teacher_code;?>">ข้อมูลประวัติการลา</a></font><img src="../picture/ico3.gif" width="10" height="10" align="absmiddle" border="0" /></font><strong><span class="NOTE">แบบใบลา ลาคลอดบุตร ลากิจส่วนตัว</span></strong></legend>
<form id="form1" name="form1" method="post" action="InsertAbsent.php" onSubmit="return confirmSubmit();">
<table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td align="center">
<table width="750" cellpadding="0" cellspacing="0">
<tr height="31">
<td height="31" width="133"> </td>
<td width="79"> </td>
<td colspan="3">แบบใบลาป่วย ลาคลอดบุตร ลากิจส่วนตัว</td>
<td width="85"> </td>
</tr>
<tr height="31">
<td height="31"> </td>
<td> </td>
<td colspan="3"> </td>
<td> </td>
</tr>
<!-- <tr height="29">
<td height="29" colspan="6">ส่วนราชการ<font size="2" face="Tahoma">
<?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] ";
?>
</font></td>
</tr> -->
<tr height="29">
<td colspan="3" align="left">ส่วนราชการ <?=$rs2["collegeName"];?></td>
<td colspan="3" align="center">
<script>DateInput('mDate', true, 'DD/MM/YYYY','<?=date("d/m/Y");?>' );</script> </td>
</tr>
<tr height="29">
<td height="29" colspan="3" align="left">เรื่อง
<select name="Absent_code" id="Absent_code">
<option value="0">--- เลือก ---</option>
<?php
$strSQL3 = " SELECT * FROM $myTable3 WHERE Absent_code != '3'"; //Where Absent_code='$Absent_code' ";
$result3 = mysql_query($strSQL3);
while( $rs3 = mysql_fetch_array($result3) ) {
echo"<option value=\"$rs3[Absent_code]\" >$rs3[Absent_type]</option>\n";
}
?>
</select> </td>
<td width="42"> </td>
<td width="248"> </td>
<td> </td>
</tr>
<tr height="29">
<td height="29" colspan="5" align="left">เรียน ผู้อำนวยการ <font size="2" face="Tahoma">
<?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] ";
?>
</font></td>
<td> </td>
</tr>
<tr height="29">
<td height="25"> </td>
<td colspan="5" align="left">
ข้าพเจ้า.
<input name="Name" type="text" id="Name" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" size="25" value="<? echo $rss[First_name]?> <? echo $rss[Teacher_name]?> <? echo $rss[Teacher_lastname]?>" readonly/>
ตำแหน่ง.
<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="<?=$rss["Position_name"];?>" readonly/> </td>
</tr>
<tr height="29">
<td height="29" colspan="6" align="left">สังกัด<font color="#0000FF" size="2" face="Tahoma">
<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="<?=$rss["Faculty_name"];?>" readonly/>
</font><font color="#0000FF" size="2" face="Tahoma">
<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] "; ?> " readonly/>
</font><span class="style11">สถาบันพระบรมราชชนก</span></td>
</tr>
<tr>
<td height="29" colspan="6" align="left">ขอลา เนื่องจาก
<input name="Absent_type" type="text" id="Absent_type" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" size="85" /> </td>
</tr>
<tr height="29">
<td height="29" colspan="6" align="left">
<table>
<tr>
<td>ขอลา ตั้งแต่วันที่</td>
<td><script>DateInput('mDate1', true, 'DD/MM/YYYY','<?=date("d/m/Y");?>');</script></td>
<td>ถึงวันที่</td>
<td><script>DateInput('mDate2', true, 'DD/MM/YYYY','<?=date("d/m/Y");?>');</script></td>
<td>
มีกำหนด
<input name="Absent_times" type="text" id="Absent_times" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed; text-align:center" size="3" maxlength="4" onkeypress="checkNumeric()"/>
วัน </td>
</tr>
</table> </td>
</tr>
<tr height="29">
<td height="29" colspan="6" align="left">
ข้าพเจ้าได้ลา
<input name="Absent_code" type="checkbox" id="Absent_code" value="2" />
ป่วย
<input name="Absent_code" type="checkbox" id="Absent_code" value="1" />
กิจส่วนตัว
<input name="Absent_code" type="checkbox" id="Absent_code" value="4" />
คลอดบุตร ครั้งสุดท้ายตั้งแต่วันที่ <font color="#0000FF" size="2" face="Tahoma">
<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";
?>" />
</font></td>
</tr>
<tr height="29">
<td height="29" colspan="6" align="left">ในระหว่างลาจะติดต่อข้าพเจ้าได้ที่<font color="#0000FF" size="2" face="Tahoma">
<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"]." ต.".$rss["districtName"]." อ.".$rss["amphurName"]." จ.".$rss['provinceName'];?>" size="60" readonly="readonly" />
</font></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="161"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr height="31">
<td height="31"> </td>
<td> </td>
<td> </td>
<td colspan="3" align="center"> <span class="style1">ขอแสดงความนับถือ</span></td>
</tr>
<tr height="29">
<td height="29" colspan="3" align="center">สถิติการลาในปีงบประมาณนี้<font color="#0000FF" size="2" face="Tahoma">
<input name="Year" type="text" id="Year" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" value="<?=$rs->Budget_year;?>" size="3" maxlength="4" />
</font></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><div align="center">(<font color="#003366" size="2" face="Tahoma">..<? echo $rss[First_name]?> <? echo $rss[Teacher_name]?> <? echo $rss[Teacher_lastname]?></font>..)
<input type="hidden" name="Teacher_code" value="<? echo $Teacher_code; ?>" />
</div></td>
<td> </td>
</tr>
<tr height="31">
<td height="31"> </td>
<td> </td>
<td> </td>
<td colspan="3" align="left"><div align="left" class="style2">ความเห็นผู้บังคับบัญชา</div></td>
</tr>
<tr height="29">
<td height="29"></td>
<td></td>
<td> </td>
<td colspan="3"><div align="center">.<font color="#0000FF" size="2" face="Tahoma">
<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="40" />
</font></div></td>
</tr>
<tr height="29">
<td height="29" colspan="3" align="left">ลงชื่อ.............................................ผู้ตรวจสอบ </td>
<td> </td>
<td>............................</td>
<td> </td>
</tr>
<tr height="29">
<td height="29" colspan="2" align="left">ตำแหน่ง........................................ </td>
<td align="left"> </td>
<td colspan="3" align="left"> (<font size="2" face="Tahoma">
<?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 ='$rss[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]";
?>
</font>)
<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">ตำแหน่ง.<font color="#0000FF" size="2" face="Tahoma">
<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] ";?>
" />
</font></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">
<input type="checkbox" name="checkbox" value="checkbox" />
อนุญาต
<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">
<input type="submit" name="Submit" value=" บันทึก " />
<input name="Submit" type="reset" id="Submit" value=" ยกเลิก " /></td>
</tr>
</table> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</form>
</fieldset></td>
</tr>
</table>
<?php include("../templates/incFooter.php"); ?>
</body>
</html>
<?php
/** Free Resource */
$dbObj->freeresult($result);
/** Close the Database */
$dbObj->disconn();
/** Unset Class */
unset($dbObj);
?>
|