Viewing file: SumPesonal.php (80.54 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/** Define Validate Access */
define( '_VALID_ACCESS', 1 );
/** Configuration */
require_once( "./configuration.php" );
require_once( $_Config_absolute_path . "/includes/framework.php" );
require_once( "./include/Function.php" );
require_once( "./calendar/check.php" );
require_once( "./calendar/cal_func.php" );
require_once( "./link/function.php" );
/** Create Database Object */
$dbObj = new DBConn;
$myTable = "personal_tb";
/** Chart */
include ("./includes/charts.php");
//=== salary_repot_tb
$query = " SELECT * FROM $myTable ORDER BY Teacher_name ASC ";
$result = $dbObj->execQuery($query);
//$rs = $dbObj->fetchArray($result);
$total = $dbObj->_numrows;
$year1 = (date("Y")+543) - 5 ;
$year2 = (date("Y")) - 10 ;
$year3 = (date("Y")) - 15 ;
$year4 = (date("Y")) - 20 ;
?>
<!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" />
<script language="javascript" src="./js/utilities.js"></script>
<script language="Javascript" src="./charts/charts.js"></script>
<title>ข้อมูลสถานะบุคลากร - <?=urldecode($topic);?></title>
<style type="text/css ">
<!--
.style1 {font-weight: bold}
.style2 {font-weight: bold}
-->
</style>
<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</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( "./templates/incMainMenuLeft.php" );?></td>
<td width="800" align="center" valign="top" style="padding:10px 0px 5px 10px"><fieldset><table width="755" border="0" cellspacing="0" cellpadding="0">
<form id="myForm" name="myForm" method="post" action="<?=$PHP_SELF;?>?Budget_Year=<?=$Budget_Year;?>&MoneyId=<?=$MoneyId;?>&page=<?=$page;?>&topic=<?=urlencode($topic);?>">
<tr>
<td height="5" colspan="2"></td>
</tr>
<tr>
<td width="493" height="30" background="./images/background/bg-head-topic-w780.gif" class="PADDING-LEFT-10"><strong><a href="index.php">หน้าหลัก</a></strong> <strong>» <strong><a href="SumPesonal.php">ข้อมูลสถานะบุคลากร</a></strong> <strong>» <span class="NOTE">ข้อมูลสรุปสถานะบุคลากร</span></strong></strong></td>
<td width="262" align="right" class="PADDING-RIGHT-10"> </td>
</tr>
<tr>
<td colspan="2" align="center"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="29" align="left" style="padding-bottom:5px;"><span class="PADDING-TOP-10"><img src="images/icons/arrow-circle-225-left.png" width="16" height="16" border="0" align="absmiddle" /> <a href="javascript:;" onclick="window.history.back();"><strong>‹ ย้อนกลับ</strong></a></span></td>
</tr>
<tr>
<td width="100%" height="29" align="center" style="padding-bottom:5px;"><label for="setdata">มิติในการดูกราฟแสดงผล</label>
<select name="setdata" id="setdata">
<option value="0" <?php if( $setdata == "0" ) echo 'selected'; ?>>เลือกมิติในการดูข้อมูล</option>
<option value="A" <?php if( $setdata == "A" ) echo 'selected'; ?>>จำนวนบุคลากรจำแนกตามภาคฝ่าย</option>
<option value="B" <?php if( $setdata == "B" ) echo 'selected'; ?>>จำนวนระดับการศึกษาของบุคลากรทุกสายงาน</option>
<option value="C" <?php if( $setdata == "C" ) echo 'selected'; ?>>จำนวนร้อยละประเภทบุคลากร</option>
<option value="D" <?php if( $setdata == "D" ) echo 'selected'; ?>>จำนวนสายงานบุคลากรที่่ปฏิบัติงานและลาศึกษาต่อ</option>
<option value="E" <?php if( $setdata == "E" ) echo 'selected'; ?>>จำนวนประเภทสายงานวิชาการ</option>
<option value="F" <?php if( $setdata == "F" ) echo 'selected'; ?>>จำนวนเพศชายหญิงแยกตามสายงาน</option>
<option value="G" <?php if( $setdata == "G" ) echo 'selected'; ?>>จำนวนประเภทบุคลากรที่มีการพัฒนาสรรถนะหลัก</option>
</select>
<input type="submit" name="multi" class="TEXT-GREEN10 WIDTH150" id="multi" value="เลือกมิติของการดูข้อมูล" /></td>
</tr>
<tr>
<td align="center" style="padding-bottom:5px;"> </td>
</tr>
<tr>
<td align="center" style="padding-bottom:5px;"><?
$setdata=$_POST[setdata];
$multi=$_POST[multi];
if($multi==TRUE){
if($setdata=="A"){
?>
<?php
$animateChart = "1";
//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "<chart caption='แผนภูมิจำนวนบุคลากร' subCaption='แยกตามหน่วยงาน/ภาคฝ่าย' pieSliceDepth='30' showBorder='1' formatNumber='0' formatNumberScale='0' forceDecimals='1' numberSuffix ='คน' animation=' " . $animateChart . "'>";
// Fetch all factory records
$strQuery = " SELECT * FROM personal_tb GROUP BY Faculty_code ";
$result111 = $dbObj->execQuery($strQuery);
//Iterate through each factory
if ($result111) {
while( $rs111 = $dbObj->fetchArray($result111) ) {
$query112 = " SELECT * FROM faculty_tb WHERE Faculty_code='$rs111[Faculty_code]' ";
$result112 = $dbObj->execQuery($query112);
$rs112 = $dbObj->fetchArray($result112);
$strQuery3 = " SELECT * FROM personal_tb WHERE StatusId='1' AND Faculty_code='$rs111[Faculty_code]' ";
$result3 = $dbObj->execQuery($strQuery3);
$numAmt3 = $dbObj->_numrows;
$dbObj->freeresult($result3);
$strXML .= "<set label=' " . $rs112['Faculty_name'] . "' value='" . $numAmt3 . "' />";
} # while
} # if
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("./charts/Pie3D.swf", "", $strXML, "", 750, 375, false, false);
?>
<?
}
if($setdata=="B"){
?>
<?php
$nub=1;
$animateChart = "1";
$strXML = "<chart caption='จำนวนระดับการศึกษาของบุคลากรทุกสายงาน' subCaption='' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix='‰ ' animation=' " . $animateChart . " '>";
$strQ = " SELECT * FROM degree_tb";
$res = $dbObj->execQuery($strQ);
$c = mysql_num_rows($res);
while( $rs0 = $dbObj->fetchArray($res) ) {
$dc = $rs0['Degree_code'];
if ($dc != 4 ){
$sql = " SELECT COUNT(Degree_code) AS num FROM personal_tb WHERE StatusId='1' AND Degree_code='$dc' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result = $dbObj->execQuery($sql);
$rs = $dbObj->fetchArray($result);
$sql1 = " SELECT COUNT(Teacher_code) AS num5 FROM personal_tb WHERE StatusId='1' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result1 = $dbObj->execQuery($sql1);
$rs1 = $dbObj->fetchArray($result1);
echo $num5 ;
$per = ( $rs['num'] * 100 ) / $rs1['num5'];
$p = number_format($per,2,'.','.');
$strXML .= "<set label='" . $rs0['Degree_name'] . "' value='" .$p . "' />";
}
}
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("charts/Column3D.swf", "", $strXML, "",550, 375, false, false);
?>
<?
}
if($setdata=="C"){
?>
<?php
$animateChart = "1";
$strXML = "<chart caption='แผนภูมิแสดงประเภทบุคลากร' subCaption='' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix='‰ ' animation=' " . $animateChart . " '>";
$strQ = " SELECT * FROM person_type_tb ";
$res = $dbObj->execQuery($strQ);
$c = mysql_num_rows($res);
while( $rs0 = $dbObj->fetchArray($res) ) {
$dc = $rs0['Ptype_code'];
if ($dc !=0 ){
$sql = " SELECT COUNT(Teacher_code) AS num FROM personal_tb WHERE ( StatusId='1' Or StatusId ='3' ) and Person_type=$dc and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result = $dbObj->execQuery($sql);
$rs = $dbObj->fetchArray($result);
$sql2 = " SELECT COUNT(Teacher_code) AS sum FROM personal_tb WHERE ( StatusId='1' Or StatusId ='3' ) and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5') ";
$result2 = $dbObj->execQuery($sql2);
$rs2 = $dbObj->fetchArray($result2);
$per = ( $rs['num'] * 100 ) / $rs2['sum'];
$p = number_format($per,2,'.','.');
$strXML .= "<set label='" . $rs0['Ptype_name'] . "' value='" .$p . "' />";
}
}
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("charts/Column3D.swf", "", $strXML, "",650, 375, false, false);
?>
<?
}
if($setdata=="D"){
?>
<?php
$animateChart = "1";
$strXML = "<chart caption='แผนภูมิแสดงประเภทบุคลากร' subCaption='' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix='‰ ' animation=' " . $animateChart . " '>";
$strQ = " SELECT * FROM teacher_type_tb Where Flag ='Y' ";
$res = $dbObj->execQuery($strQ);
$c = mysql_num_rows($res);
while( $rs0 = $dbObj->fetchArray($res) ) {
$dc = $rs0['Ttype_code'];
if ($dc !=0 ){
$sql = " SELECT COUNT(Teacher_code) AS num FROM personal_tb pt, teacher_type_tb tt WHERE pt.Teacher_type=$dc and pt.Teacher_type=tt.Ttype_code and tt.Flag='Y' and (pt.StatusId='1' Or pt.StatusId='3') ";
$result = $dbObj->execQuery($sql);
$rs = $dbObj->fetchArray($result);
$sql2 = " SELECT COUNT(Teacher_code) AS sum FROM personal_tb pt, teacher_type_tb tt WHERE pt.Teacher_type=tt.Ttype_code and tt.Flag='Y' and (pt.StatusId='1' Or pt.StatusId='3') ";
$result2 = $dbObj->execQuery($sql2);
$rs2 = $dbObj->fetchArray($result2);
$per = ( $rs['num'] * 100 ) / $rs2['sum'];
$p = number_format($per,2,'.','.');
$strXML .= "<set label='" . $rs0['Ttype_name'] . "' value='" .$p . "' />";
}
}
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("charts/Column2D.swf", "", $strXML, "",600, 375, false, false);
?>
<?
}
if($setdata=="E"){
?>
<?php
$animateChart = "1";
//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "<chart caption='กราฟแสดงจำนวนประเภทสายงานวิชาการ' subCaption='ของข้าราชการที่่ปฏิบัติงานและลาศึกษาต่อ' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' คน' animation=' " . $animateChart . "'>";
// Fetch all factory records
$strQuery = "SELECT * FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode Group By dh.levelcode ";
$result1 = mysql_query($strQuery);
//Iterate through each factory
if ($result1) {
while( $rs1 = mysql_fetch_array($result1) ) {
$error_id = $rs1['id'];
$strQuery = " SELECT COUNT(dh.levelcode) AS sum FROM dev_clevelpos dc, dev_hrperson dh Where dh.levelcode='$rs1[levelcode]' and dc.levelcode =dh.levelcode and (dh.statusId='1' Or dh.statusId='3' ) ";
$result3 = $dbObj->execQuery($strQuery);
$rs3 = $dbObj->fetchArray($result3);
$strXML .= "<set label=' " . $rs1['levelname'] . "' value='".$rs3['sum'] . "' />";
} # while
} # if
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("./charts/Pie3D.swf", "", $strXML, "", 750, 375, false, false);
?>
<?
}
if($setdata=="F"){
?>
<?php
$animateChart = "1";
//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "<chart caption='กราฟแสดงจำนวนเพศชายหญิงแยกตามสายงาน' subCaption='' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' คน' animation=' " . $animateChart . "'>";
// Fetch all factory records
$strQuery = " SELECT * FROM teacher_type_tb Where Flag ='Y' ";
$result1 = mysql_query($strQuery);
//Iterate through each factory
if( $result1 ) {
while( $rs1 = mysql_fetch_array($result1) ) {
$Ttype_name = $rs1['Ttype_name'];
$strQuery2 = " SELECT * FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Teacher_type='$rs1[Ttype_code]' and Degree_code='1' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) and Sex ='ชาย' ";
$result2 = mysql_query($strQuery2);
$numAmt2 = mysql_num_rows($result2);
mysql_free_result($result2);
$strQuery3 = " SELECT * FROM $myTable WHERE (StatusId='1' Or StatusId='3' ) and Teacher_type='$rs1[Ttype_code]' and Degree_code='1' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) and Sex ='หญิง' ";
$result3 = mysql_query($strQuery3);
$numAmt3 = mysql_num_rows($result3);
mysql_free_result($result3);
$strXML .= "<set label=' " . $Ttype_name . " (ช)' value='" . $numAmt2 . "' />";
$strXML .= "<set label=' " . $Ttype_name . " (ญ)' value='" . $numAmt3 . "' />";
} # while
} # if
mysql_free_result($result1);
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("./charts/Pie3D.swf", "", $strXML, "", 750, 375, false, false);
?>
<?
}
if($setdata=="E"){
?>
<?php
$animateChart = "1";
//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "<chart caption='กราฟแสดงจำนวนประเภทสายงานวิชาการ' subCaption='ของข้าราชการที่่ปฏิบัติงานและลาศึกษาต่อ' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' คน' animation=' " . $animateChart . "'>";
// Fetch all factory records
$strQuery = "SELECT * FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode Group By dh.levelcode ";
$result1 = mysql_query($strQuery);
//Iterate through each factory
if ($result1) {
while( $rs1 = mysql_fetch_array($result1) ) {
$error_id = $rs1['id'];
$strQuery = " SELECT COUNT(dh.levelcode) AS sum FROM dev_clevelpos dc, dev_hrperson dh Where dh.levelcode='$rs1[levelcode]' and dc.levelcode =dh.levelcode and (dh.statusId='1' Or dh.statusId='3' ) ";
$result3 = $dbObj->execQuery($strQuery);
$rs3 = $dbObj->fetchArray($result3);
$strXML .= "<set label=' " . $rs1['levelname'] . "' value='".$rs3['sum'] . "' />";
} # while
} # if
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("./charts/Pie3D.swf", "", $strXML, "", 750, 375, false, false);
?>
<?
}
}
?></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="left"> </td>
</tr>
<tr>
<td colspan="2" align="left"><img src="images/icons/folder-open-doc-text.png" width="16" height="16" border="0" align="absmiddle" /> จำนวนประเภทบุคลากรประจำที่มีวุฒิการศึกษาสูงสุด <a href="GrapDegree.php">แผนภูมิแสดงวุฒิกาารศึกษา</a></td>
</tr>
<tr>
<td colspan="2" align="left"> </td>
</tr>
<tr>
<td colspan="2" align="right"><table width="95%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF" style="background-color:#eeeeee; border:0px solid gray">
<tr bgcolor="<?=$bgColor;?>">
<td width="4%" height="22" align="center" bgcolor="#6699FF">No</td>
<td width="43%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">รายการ </td>
<td width="10%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ปริญญาตรี</td>
<td width="10%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ปริญญาโท</td>
<td width="15%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ปริญญาเอก</td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">จำนวน</td>
</tr>
<?php
$sql = " SELECT * FROM person_type_tb " ;
$result19 = $dbObj->execQuery($sql);
$no = 1+($display-1)*$limit;
while( $rss13 = $dbObj->fetchArray($result19) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" align="center" bgcolor="#FFFFFF"><?=$no;?></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?=$rss13['Ptype_name'];?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Person_type='$rss13[Ptype_code]' and Degree_code='1' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result11 = $dbObj->execQuery($sql);
$rs11 = $dbObj->fetchArray($result11);
$dbObj->freeresult($result11);
echo $rs11['num'];
?>
</a><a href="PersonalDataType.php?StatusId=1&Person_type=<?=$rss3['Ptype_code'];?>"></a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Person_type='$rss13[Ptype_code]' and Degree_code='2' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result12 = $dbObj->execQuery($sql);
$rs12 = $dbObj->fetchArray($result12);
$dbObj->freeresult($result12);
echo $rs12['num'];
?>
</a><a href="PersonalDataType.php?StatusId=3&Person_type=<?=$rss3['Ptype_code'];?>"></a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Person_type='$rss13[Ptype_code]' and Degree_code='3' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result13 = $dbObj->execQuery($sql);
$rs13 = $dbObj->fetchArray($result13);
echo $rs13['num'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sum = $rs11['num']+ $rs12['num']+ $rs13['num'];
echo $sum ;
?></td>
<?php
$no++ ;
} # while
?>
</tr>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" colspan="2" align="center" bgcolor="#FFCCFF">สรุป</td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"></a>
<?php
$sql = " SELECT COUNT(Teacher_type) AS num5 FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Degree_code='1' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result1 = $dbObj->execQuery($sql);
$rs5 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
echo $rs5['num5'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num6 FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Degree_code='2' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result1 = $dbObj->execQuery($sql);
$rs6 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
echo $rs6['num6'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num7 FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Degree_code='3' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result1 = $dbObj->execQuery($sql);
$rs7 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
echo $rs7['num7'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sum = $rs5['num5']+ $rs6['num6']+ $rs7['num7'] ;
echo $sum ;
?></td>
</tr>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" colspan="2" align="center" bgcolor="#FF99CC">สัดส่วน</td>
<td align="center" bgcolor="#FF99CC" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and (Degree_code='1' Or Degree_code='2' Or Degree_code='3' ) and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result3 = $dbObj->execQuery($sql);
$rss = $dbObj->fetchArray($result3);
$sql = " SELECT COUNT(Teacher_type) AS sum FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Degree_code='1' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result2 = $dbObj->execQuery($sql);
$rs2 = $dbObj->fetchArray($result2);
$per2= ( $rs2['sum'] * 100 ) / $rss['num'] ;
echo number_format($per2,'2','.','')." %";
?> </td>
<td align="center" bgcolor="#FF99CC" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and (Degree_code='1' Or Degree_code='2' Or Degree_code='3' ) and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result3 = $dbObj->execQuery($sql);
$rss = $dbObj->fetchArray($result3);
$sql = " SELECT COUNT(Teacher_type) AS sum FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Degree_code='2' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result2 = $dbObj->execQuery($sql);
$rs2 = $dbObj->fetchArray($result2);
$per2= ( $rs2['sum'] * 100 ) / $rss['num'] ;
echo number_format($per2,'2','.','')." %";
?></td>
<td align="center" bgcolor="#FF99CC" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and (Degree_code='1' Or Degree_code='2' Or Degree_code='3' ) and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result3 = $dbObj->execQuery($sql);
$rss = $dbObj->fetchArray($result3);
$sql = " SELECT COUNT(Teacher_type) AS sum FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Degree_code='3' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result2 = $dbObj->execQuery($sql);
$rs2 = $dbObj->fetchArray($result2);
$per2= ( $rs2['sum'] * 100 ) / $rss['num'] ;
echo number_format($per2,'2','.','')." %";
?> </td>
<td align="center" bgcolor="#FF99CC" class="PADDING-LEFT-5">100 %</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="center"> </td>
</tr>
<tr>
<td colspan="2" align="left"><img src="images/icons/folder-open-doc-text.png" width="16" height="16" border="0" align="absmiddle" /> จำนวนสายงานบุคลากรประจำที่มีวุฒิการศึกษาสูงสุด</td>
</tr>
<tr>
<td colspan="2" align="left"> </td>
</tr>
<tr>
<td colspan="2" align="right"><table width="95%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF" style="background-color:#eeeeee; border:0px solid gray">
<tr bgcolor="<?=$bgColor;?>">
<td width="5%" height="22" align="center" bgcolor="#6699FF">No</td>
<td width="48%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">รายการ </td>
<td width="11%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ปริญญาตรี</td>
<td width="14%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ปริญญาโท</td>
<td width="12%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ปริญญาเอก</td>
<td width="10%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">จำนวน</td>
</tr>
<?php
$sql = " SELECT * FROM teacher_type_tb Where Flag ='Y' " ;
$result8 = $dbObj->execQuery($sql);
$no = 1+($display-1)*$limit;
while( $rss4 = $dbObj->fetchArray($result8) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" align="center" bgcolor="#FFFFFF"><?=$no;?></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?=$rss4['Ttype_name'];?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Teacher_type='$rss4[Ttype_code]' and Degree_code='1' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result21 = $dbObj->execQuery($sql);
$rs21 = $dbObj->fetchArray($result21);
echo $rs21['num'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Teacher_type='$rss4[Ttype_code]' and Degree_code='2' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result22 = $dbObj->execQuery($sql);
$rs22 = $dbObj->fetchArray($result22);
echo $rs22['num'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sql = "SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Teacher_type='$rss4[Ttype_code]' and Degree_code='3' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result23 = $dbObj->execQuery($sql);
$rs23 = $dbObj->fetchArray($result23);
echo $rs23['num'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sum = $rs21['num']+ $rs22['num']+ $rs23['num'];
echo $sum ;
?></td>
<?php
$no++ ;
} # while
?>
</tr>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" colspan="2" align="center" bgcolor="#FFCCFF">สรุป</td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_code) AS num5 FROM personal_tb pt, teacher_type_tb tt WHERE pt.Teacher_type=tt.Ttype_code and tt.Flag='Y' and (pt.StatusId='1' Or pt.StatusId='3' ) and pt.Degree_code='1' and ( pt.Person_type='1' Or pt.Person_type='2' Or pt.Person_type='3' Or pt.Person_type='4' Or pt.Person_type='5' Or pt.Person_type='6' ) ";
$result1 = $dbObj->execQuery($sql);
$rs1 = $dbObj->fetchArray($result1);
echo $rs1['num5'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_code) AS num5 FROM personal_tb pt, teacher_type_tb tt WHERE pt.Teacher_type=tt.Ttype_code and tt.Flag='Y' and (pt.StatusId='1' Or pt.StatusId='3' ) and pt.Degree_code='2' and ( pt.Person_type='1' Or pt.Person_type='2' Or pt.Person_type='3' Or pt.Person_type='4' Or pt.Person_type='5' Or pt.Person_type='6' ) ";
$result2 = $dbObj->execQuery($sql);
$rs2 = $dbObj->fetchArray($result2);
echo $rs2['num5'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_code) AS num5 FROM personal_tb pt, teacher_type_tb tt WHERE pt.Teacher_type=tt.Ttype_code and tt.Flag='Y' and (pt.StatusId='1' Or pt.StatusId='3' ) and pt.Degree_code='3' and ( pt.Person_type='1' Or pt.Person_type='2' Or pt.Person_type='3' Or pt.Person_type='4' Or pt.Person_type='5' Or pt.Person_type='6' ) ";
$result3 = $dbObj->execQuery($sql);
$rs3 = $dbObj->fetchArray($result3);
echo $rs3['num5'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sum = $rs1['num5']+ $rs2['num5']+ $rs3['num5'];
echo $sum ;
?></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="right"> </td>
</tr>
<tr>
<td colspan="2" align="left"><img src="images/icons/folder-open-doc-text.png" width="16" height="16" border="0" align="absmiddle" /> จำนวนบุคลากรประจำแยกตามเพศ</td>
</tr>
<tr>
<td colspan="2" align="right"> </td>
</tr>
<tr>
<td colspan="2" align="right"><table width="94%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF" style="background-color:#eeeeee; border:0px solid gray">
<tr bgcolor="<?=$bgColor;?>">
<td width="4%" height="22" align="center" bgcolor="#6699FF">No</td>
<td width="48%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">รายการ </td>
<td width="12%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ชาย</td>
<td width="14%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">หญิง</td>
<td width="13%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">จำนวน</td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">สัดส่วน</td>
</tr>
<?php
$sql = " SELECT * FROM teacher_type_tb Where Flag ='Y' " ;
$result8 = $dbObj->execQuery($sql);
$no = 1+($display-1)*$limit;
while( $rss4 = $dbObj->fetchArray($result8) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" align="center" bgcolor="#FFFFFF"><?=$no;?></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?=$rss4['Ttype_name'];?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Teacher_type='$rss4[Ttype_code]' and Sex ='ชาย' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='5' ) ";
$result21 = $dbObj->execQuery($sql);
$rs21 = $dbObj->fetchArray($result21);
echo $rs21['num'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Teacher_type='$rss4[Ttype_code]' and Sex ='หญิง' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='5' ) ";
$result22 = $dbObj->execQuery($sql);
$rs22 = $dbObj->fetchArray($result22);
echo $rs22['num'];
?> </a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sum = $rs21['num']+ $rs22['num'] ;
echo $sum ;
?></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE Teacher_type='$rss4[Ttype_code]' and (StatusId='1' Or StatusId='3' ) and ( Sex ='ชาย' Or Sex ='หญิง' ) and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result3 = $dbObj->execQuery($sql);
$rss = $dbObj->fetchArray($result3);
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and ( Sex ='ชาย' Or Sex ='หญิง' ) and (Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result2 = $dbObj->execQuery($sql);
$rss2 = $dbObj->fetchArray($result2);
$per2= ( $rss['num'] * 100 ) / $rss2['num'] ;
echo number_format($per2,'2','.','')." %";
?></td>
<?php
$no++ ;
} # while
?>
</tr>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" colspan="2" align="center" bgcolor="#FFCCFF">สรุป</td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_code) AS num5 FROM personal_tb pt, teacher_type_tb tt WHERE pt.Teacher_type=tt.Ttype_code and tt.Flag='Y' and (pt.StatusId='1' Or pt.StatusId='3' ) and pt.Sex ='ชาย' and ( pt.Person_type='1' Or pt.Person_type='2' Or pt.Person_type='3' Or pt.Person_type='4' Or pt.Person_type='5' Or pt.Person_type='6' ) ";
$result1 = $dbObj->execQuery($sql);
$rs1 = $dbObj->fetchArray($result1);
echo $rs1['num5'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_code) AS num5 FROM personal_tb pt, teacher_type_tb tt WHERE pt.Teacher_type=tt.Ttype_code and tt.Flag='Y' and (pt.StatusId='1' Or pt.StatusId='3' ) and pt.Sex ='หญิง' and ( pt.Person_type='1' Or pt.Person_type='2' Or pt.Person_type='3' Or pt.Person_type='4' Or pt.Person_type='5' Or pt.Person_type='6' ) ";
$result2 = $dbObj->execQuery($sql);
$rs2 = $dbObj->fetchArray($result2);
echo $rs2['num5'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sum = $rs1['num5']+ $rs2['num5'] ;
echo $sum ;
?></td>
<td rowspan="2" align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5">100%</td>
</tr>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" colspan="2" align="center" bgcolor="#FF99FF">สัดส่วนเพศชายหญิง</td>
<td align="center" bgcolor="#FF99FF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and ( Sex ='ชาย' Or Sex ='หญิง' ) and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='5' ) ";
$result3 = $dbObj->execQuery($sql);
$rss = $dbObj->fetchArray($result3);
$sql = " SELECT COUNT(Teacher_type) AS sum FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Sex ='ชาย' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result2 = $dbObj->execQuery($sql);
$rs2 = $dbObj->fetchArray($result2);
$per2= ( $rs2['sum'] * 100 ) / $rss['num'] ;
echo number_format($per2,'2','.','')." %";
?> </td>
<td align="center" bgcolor="#FF99FF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and ( Sex ='ชาย' Or Sex ='หญิง' ) and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result3 = $dbObj->execQuery($sql);
$rss = $dbObj->fetchArray($result3);
$sql = " SELECT COUNT(Teacher_type) AS sum FROM personal_tb WHERE (StatusId='1' Or StatusId='3' ) and Sex ='หญิง' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result2 = $dbObj->execQuery($sql);
$rs2 = $dbObj->fetchArray($result2);
$per2= ( $rs2['sum'] * 100 ) / $rss['num'] ;
echo number_format($per2,'2','.','')." %";
?> </td>
<td align="center" bgcolor="#FF99FF" class="PADDING-LEFT-5"> </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="right"> </td>
</tr>
<tr>
<td colspan="2" align="left"><img src="images/icons/folder-open-doc-text.png" width="16" height="16" border="0" align="absmiddle" /> จำนวนประเภทบุคลากรประจำที่่ปฏิบัติงานและลาศึกษาต่อ <a href="GrapStatus.php">แผนภูมิสารสนเทศประเภทบุคลากร</a></td>
</tr>
<tr>
<td colspan="2" align="left"> </td>
</tr>
<tr>
<td colspan="2" align="right"><table width="96%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF" style="background-color:#eeeeee; border:0px solid gray">
<tr bgcolor="<?=$bgColor;?>">
<td width="3%" height="22" align="center" bgcolor="#6699FF">No</td>
<td width="39%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">รายการ </td>
<td width="10%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ปฏิบัติงาน</td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ลาศึกษา</td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">จำนวน</td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">สัดส่วน</td>
<td width="12%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ไปช่วยราชการ</td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">จำนวน</td>
</tr>
<?php
$sql = " SELECT * FROM person_type_tb " ;
$result9 = $dbObj->execQuery($sql);
$no = 1+($display-1)*$limit;
while( $rss3 = $dbObj->fetchArray($result9) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" align="center" bgcolor="#FFFFFF"><?=$no;?></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?=$rss3['Ptype_name'];?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sql = " SELECT COUNT(Teacher_type) AS num1 FROM personal_tb WHERE StatusId='1' and Person_type='$rss3[Ptype_code]' ";
$result1 = $dbObj->execQuery($sql);
$rs1 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
echo $rs1['num1'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sql = " SELECT COUNT(Teacher_type) AS num2 FROM personal_tb WHERE StatusId='3' and Person_type='$rss3[Ptype_code]' ";
$result2 = $dbObj->execQuery($sql);
$rs2 = $dbObj->fetchArray($result2);
$dbObj->freeresult($result7);
echo $rs2['num2'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sum = $rs1['num1']+ $rs2['num2'];
echo $sum ;
?></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num5 FROM personal_tb WHERE ( StatusId='1' Or StatusId ='3' ) and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result1 = $dbObj->execQuery($sql);
$rss1 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
$sql = " SELECT COUNT(Teacher_type) AS sum FROM personal_tb WHERE Person_type='$rss3[Ptype_code]' and ( StatusId='1' Or StatusId ='3' ) and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result2 = $dbObj->execQuery($sql);
$rss2 = $dbObj->fetchArray($result2);
$per2= ( $rss2['sum'] * 100 ) / $rss1['num5'] ;
echo number_format($per2,'2','.','')." %";
?> </td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sql = " SELECT COUNT(Teacher_type) AS num3 FROM personal_tb WHERE StatusId='2' and Person_type='$rss3[Ptype_code]' ";
$result3 = $dbObj->execQuery($sql);
$rs3 = $dbObj->fetchArray($result3);
$dbObj->freeresult($result7);
echo $rs3['num3'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sum = $rs1['num1']+ $rs2['num2']+ $rs3['num3'];
echo $sum ;
?>
</a></td>
<?php
$no++ ;
} # while
?>
</tr>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" colspan="2" align="center" bgcolor="#FFCCFF">สรุป</td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num1 FROM personal_tb WHERE StatusId='1' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result1 = $dbObj->execQuery($sql);
$rs1 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
echo $rs1['num1'];
?>
</a></a></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num1 FROM personal_tb WHERE StatusId='3' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result1 = $dbObj->execQuery($sql);
$rs2 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
echo $rs2['num1'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE ( StatusId='1' Or StatusId ='3' ) and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result1 = $dbObj->execQuery($sql);
$rs3 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
echo $rs3['num'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5">100%</td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_type) AS num6 FROM personal_tb WHERE StatusId='2' and ( Person_type='1' Or Person_type='2' Or Person_type='3' Or Person_type='4' Or Person_type='5' Or Person_type='6' ) ";
$result1 = $dbObj->execQuery($sql);
$rs6 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
echo $rs6['num6'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sum = $rs3['num']+ $rs6['num6'] ;
echo $sum ;
?></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="center"> </td>
</tr>
<tr>
<td colspan="2" align="left"><img src="images/icons/folder-open-doc-text.png" width="16" height="16" border="0" align="absmiddle" /> จำนวนสายงานบุคลากรที่่ปฏิบัติงานและลาศึกษาต่อ <a href="GrapFacult.php">แผนภูมิสารสนเทศแสดงสายงานของบุคลากร</a></td>
</tr>
<tr>
<td colspan="2" align="left"> </td>
</tr>
<tr>
<td colspan="2" align="right"><table width="95%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF" style="background-color:#eeeeee; border:0px solid gray">
<tr bgcolor="<?=$bgColor;?>">
<td width="3%" height="22" align="center" bgcolor="#6699FF">No</td>
<td width="39%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">รายการ </td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ปฏิบัติงาน</td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ลาศึกษา</td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">จำนวน</td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">สัดส่วน</td>
<td width="13%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ไปช่วยราชการ</td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">จำนวน</td>
</tr>
<?php
$sql = " SELECT * FROM teacher_type_tb Where Flag ='Y' " ;
$result8 = $dbObj->execQuery($sql);
$no = 1+($display-1)*$limit;
while( $rss4 = $dbObj->fetchArray($result8) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" align="center" bgcolor="#FFFFFF"><?=$no;?></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?=$rss4['Ttype_name'];?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE StatusId='1' and Teacher_type='$rss4[Ttype_code]' ";
$result11 = $dbObj->execQuery($sql);
$rs11 = $dbObj->fetchArray($result11);
$dbObj->freeresult($result11);
echo $rs11['num'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE StatusId='3' and Teacher_type='$rss4[Ttype_code]' ";
$result12 = $dbObj->execQuery($sql);
$rs12 = $dbObj->fetchArray($result12);
$dbObj->freeresult($result12);
echo $rs12['num'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sum = $rs11['num']+ $rs12['num'];
echo $sum ;
?></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_code) AS num5 FROM personal_tb pt, teacher_type_tb tt WHERE pt.Teacher_type=tt.Ttype_code and tt.Flag='Y' and (pt.StatusId='3' Or pt.StatusId='1') ";
$result1 = $dbObj->execQuery($sql);
$rss1 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
$sql = " SELECT COUNT(Teacher_type) AS sum FROM personal_tb pt, teacher_type_tb tt WHERE pt.Teacher_type=tt.Ttype_code and tt.Flag='Y' and pt.Teacher_type='$rss4[Ttype_code]' and ( pt.StatusId='1' Or pt.StatusId ='3' ) and ( pt.Person_type='1' Or pt.Person_type='2' Or pt.Person_type='3' Or pt.Person_type='4' Or pt.Person_type='5' Or pt.Person_type='6' ) ";
$result2 = $dbObj->execQuery($sql);
$rss2 = $dbObj->fetchArray($result2);
$per2= ( $rss2['sum'] * 100 ) / $rss1['num5'] ;
echo number_format($per2,'2','.','')." %";
?> </td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sql = " SELECT COUNT(Teacher_type) AS num FROM personal_tb WHERE StatusId='2' and Teacher_type='$rss4[Ttype_code]' ";
$result13 = $dbObj->execQuery($sql);
$rs13 = $dbObj->fetchArray($result13);
$dbObj->freeresult($result13);
echo $rs13['num'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sum = $rs11['num']+ $rs12['num']+ $rs13['num']; ;
echo $sum ;
?></td>
<?php
$no++ ;
} # while
?>
</tr>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" colspan="2" align="center" bgcolor="#FFCCFF">สรุป</td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_code) AS num5 FROM personal_tb pt, teacher_type_tb tt WHERE pt.Teacher_type=tt.Ttype_code and tt.Flag='Y' and pt.StatusId='1' ";
$result1 = $dbObj->execQuery($sql);
$rs5 = $dbObj->fetchArray($result1);
echo $rs5['num5'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_code) AS num6 FROM personal_tb pt, teacher_type_tb tt WHERE pt.Teacher_type=tt.Ttype_code and tt.Flag='Y' and pt.StatusId='3' ";
$result1 = $dbObj->execQuery($sql);
$rs6 = $dbObj->fetchArray($result1);
echo $rs6['num6'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sum = $rs5['num5']+ $rs6['num6'];
echo $sum ;
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5">100%</td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(Teacher_code) AS num7 FROM personal_tb pt, teacher_type_tb tt WHERE pt.Teacher_type=tt.Ttype_code and tt.Flag='Y' and pt.StatusId='2' ";
$result6 = $dbObj->execQuery($sql);
$rs7= $dbObj->fetchArray($result6);
echo $rs7['num7'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sum = $rs5['num5']+ $rs6['num6'] + $rs7['num7'] ;
echo $sum ;
?></td>
</tr>
</table></td>
</tr>
<tr>
<td height="2" colspan="2" align="center" valign="top"> </td>
</tr>
<tr>
<td colspan="2" align="center"> </td>
</tr>
<tr>
<td colspan="2"><img src="images/icons/folder-open-doc-text.png" width="16" height="16" border="0" align="absmiddle" /> จำนวนประเภทสายงานวิชาการของข้าราชการที่่ปฏิบัติงานและลาศึกษาต่อ </td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><table width="95%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF" style="background-color:#eeeeee; border:0px solid gray">
<tr bgcolor="<?=$bgColor;?>">
<td width="3%" height="22" align="center" bgcolor="#6699FF">No</td>
<td width="41%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">รายการ </td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ปฏิบัติงาน</td>
<td width="8%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ลาศึกษา</td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">จำนวน</td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">สัดส่วน</td>
<td width="13%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ไปช่วยราชการ</td>
<td width="8%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">จำนวน</td>
</tr>
<?php
$sql = " SELECT * FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode Group By dh.levelcode " ;
$result5 = $dbObj->execQuery($sql);
$no = 1+($display-1)*$limit;
while( $rs5 = $dbObj->fetchArray($result5) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" align="center" bgcolor="#FFFFFF"><?=$no;?></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?=$rs5['levelname'];?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(dh.levelcode) AS num1 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and dh.statusId='1' and dh.levelcode='$rs5[levelcode]' ";
$result1 = $dbObj->execQuery($sql);
$rs1 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
echo $rs1['num1'];
?>
</a></td>
<td align="center"bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(dh.levelcode) AS num2 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and dh.statusId='3' and dh.levelcode='$rs5[levelcode]' ";
$result3 = $dbObj->execQuery($sql);
$rs3 = $dbObj->fetchArray($result3);
$dbObj->freeresult($result7);
echo $rs3['num2'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sum = $rs1['num1']+ $rs3['num2'];
echo $sum ;
?></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sql = "SELECT COUNT(dh.levelcode) AS sum FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and (dh.statusId='1' Or dh.statusId='3' ) ";
$result2 = $dbObj->execQuery($sql);
$rs2 = $dbObj->fetchArray($result2);
$per2= ( $rs1['num1'] * 100 ) / $rs2['sum'] ;
echo number_format($per2,'2','.','')." %";
?></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(dh.levelcode) AS num3 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and dh.statusId='2' and dh.levelcode='$rs5[levelcode]' ";
$result4 = $dbObj->execQuery($sql);
$rs4 = $dbObj->fetchArray($result4);
$dbObj->freeresult($result7);
echo $rs4['num3'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sum = $rs1['num1']+ $rs3['num2']+ $rs4['num3'];
echo $sum ;
?>
</a></td>
<?php
$no++ ;
} # while
?>
</tr>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" colspan="2" align="center" bgcolor="#FFCCFF">สรุป</td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = "SELECT COUNT(dh.levelcode) AS num4 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and dh.statusId='1' ";
$result4 = $dbObj->execQuery($sql);
$rs4 = $dbObj->fetchArray($result4);
$dbObj->freeresult($result4);
echo $rs4['num4'];
?>
</a></a></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(dh.levelcode) AS num5 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and dh.statusId='3' ";
$result5 = $dbObj->execQuery($sql);
$rs5 = $dbObj->fetchArray($result5);
echo $rs5['num5'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sum = $rs4['num4']+ $rs5['num5'];
echo $sum ;
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5">100%</td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sql = "SELECT COUNT(dh.levelcode) AS num7 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and dh.statusId='2' ";
$result7 = $dbObj->execQuery($sql);
$rs7 = $dbObj->fetchArray($result7);
$dbObj->freeresult($result7);
echo $rs7['num7'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
$sum = $rs4['num4']+ $rs5['num5']+ $rs7['num7'] ;
echo $sum ;
?></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><img src="images/icons/folder-open-doc-text.png" width="16" height="16" border="0" align="absmiddle" /> จำนวนช่วงอายุราชการตามประเภทสายงานวิชาการของข้าราชการ</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><table width="95%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF" style="background-color:#eeeeee; border:0px solid gray">
<tr bgcolor="<?=$bgColor;?>">
<td width="3%" height="22" align="center" bgcolor="#6699FF">No</td>
<td width="38%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">รายการ </td>
<td width="10%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">1-5 ปี</td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">6-10 ปี </td>
<td width="10%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">11-15 ปี </td>
<td width="10%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">16-20 ปี </td>
<td width="10%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5"> 20 ปี ขึ้นไป</td>
</tr>
<?php
$sql = " SELECT * FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode Group By dh.levelcode " ;
$result5 = $dbObj->execQuery($sql);
$no = 1+($display-1)*$limit;
while( $rs5 = $dbObj->fetchArray($result5) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" align="center" bgcolor="#FFFFFF"><?=$no;?></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?=$rs5['levelname'];?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
//$sql = " SELECT COUNT(dh.levelcode) AS num1 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and (dh.statusId='1' Or dh.statusId='3' ) and dh.levelcode='$rs5[levelcode]' and dh.appointdate >= '".$year2."-00-00' and dh.appointdate <= '".$year4."-00-00' ";
//$sql = " SELECT COUNT(dh.levelcode) AS num1 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and (dh.statusId='1' Or dh.statusId='3' ) and dh.levelcode='$rs5[levelcode]' and datediff('".((date('Y')).date('-m-d'))."',dh.appointdate) <=1825";
$sql = "SELECT count(*) as num1 FROM dev_hrperson dh, dev_clevelpos dc WHERE dh.levelcode='$rs5[levelcode]' AND dc.levelcode = dh.levelcode AND dh.fperson = 1 AND (dh.statusId = 1 OR dh.statusId = 3) AND dh.appointdate != '0000-00-00' AND (dh.appointdate >= date_add(curdate(), interval -5 year) OR (dh.appointdate < date_add(curdate(), interval -5 year) AND dh.appointdate > date_add(curdate(), interval -6 year)))";
$result1 = $dbObj->execQuery($sql);
$rs1 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
echo $rs1['num1'];
// echo (date('Y')+543) + (5 - ((date('Y')+543) - substr($rs5['appointdate'],0,4)));
?>
</a></td>
<td align="center"bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
//$sql = " SELECT COUNT(dh.levelcode) AS num1 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and (dh.statusId='1' Or dh.statusId='3' ) and dh.levelcode='$rs5[levelcode]' and datediff('".((date('Y')).date('-m-d'))."',dh.appointdate) <=3650 ";
$sql = "SELECT count(*) as num1 FROM dev_hrperson dh, dev_clevelpos dc WHERE dh.levelcode='$rs5[levelcode]' AND dc.levelcode = dh.levelcode AND dh.fperson = 1 AND ((appointdate <= date_add(curdate(), interval -6 year) AND dh.appointdate != '0000-00-00' AND dh.appointdate >= date_add(curdate(), interval -10 year)) OR (dh.appointdate < date_add(curdate(), interval -10 year) AND dh.appointdate > date_add(curdate(), interval -11 year)))";
$result1 = $dbObj->execQuery($sql);
$rs1 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
echo $rs1['num1'];
?> </a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
//$sql = " SELECT COUNT(dh.levelcode) AS num1 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and (dh.statusId='1' Or dh.statusId='3' ) and dh.levelcode='$rs5[levelcode]' and datediff('".((date('Y')).date('-m-d'))."',dh.appointdate) <=5475 ";
$sql = "SELECT count(*) as num1 FROM dev_hrperson dh, dev_clevelpos dc WHERE dh.levelcode='$rs5[levelcode]' AND dc.levelcode = dh.levelcode AND dh.fperson = 1 AND (dh.statusId = 1 OR dh.statusId = 3) AND dh.appointdate != '0000-00-00' AND ((appointdate <= date_add(curdate(), interval -11 year) AND dh.appointdate >= date_add(curdate(), interval -15 year)) OR (dh.appointdate < date_add(curdate(), interval -15 year) AND dh.appointdate > date_add(curdate(), interval -16 year)))";
$result1 = $dbObj->execQuery($sql);
$rs1 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
echo $rs1['num1'];
?></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
//$sql = " SELECT COUNT(dh.levelcode) AS num1 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and (dh.statusId='1' Or dh.statusId='3' ) and dh.levelcode='$rs5[levelcode]' and datediff('".((date('Y')).date('-m-d'))."',dh.appointdate) <=7300 ";
$sql = "SELECT count(*) as num1 FROM dev_hrperson dh, dev_clevelpos dc WHERE dh.levelcode='$rs5[levelcode]' AND dc.levelcode = dh.levelcode AND dh.fperson = 1 AND (dh.statusId = 1 OR dh.statusId = 3) AND dh.appointdate != '0000-00-00' AND (dh.appointdate <= date_add(curdate(), interval -16 year) AND dh.appointdate >= date_add(curdate(), interval -20 year))";
$result1 = $dbObj->execQuery($sql);
$rs1 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
echo $rs1['num1'];
?></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
//$sql = " SELECT COUNT(dh.levelcode) AS num1 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and (dh.statusId='1' Or dh.statusId='3' ) and dh.levelcode='$rs5[levelcode]' and datediff('".((date('Y')).date('-m-d'))."',dh.appointdate) >=7300 ";
$sql = "SELECT count(*) as num1 FROM dev_hrperson dh, dev_clevelpos dc WHERE dh.levelcode='$rs5[levelcode]' AND dc.levelcode = dh.levelcode AND dh.fperson = 1 AND (dh.statusId = 1 OR dh.statusId = 3) AND dh.appointdate != '0000-00-00' AND dh.appointdate < date_add(curdate(), interval -20 year)";
$result1 = $dbObj->execQuery($sql);
$rs1 = $dbObj->fetchArray($result1);
$dbObj->freeresult($result7);
echo $rs1['num1'];
?> </a></td>
<?php
$no++ ;
} # while
?>
</tr>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" colspan="2" align="center" bgcolor="#FFCCFF">สรุป</td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
//$sql = "SELECT COUNT(dh.levelcode) AS num4 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and (dh.statusId='1' Or dh.statusId='3' ) and datediff('".((date('Y')).date('-m-d'))."',appointdate) >=2015 ";
$sql = "SELECT count(*) as num4 FROM dev_hrperson dh, dev_clevelpos dc WHERE dc.levelcode = dh.levelcode AND dh.fperson = 1 AND (dh.statusId = 1 OR dh.statusId = 3) AND dh.appointdate != '0000-00-00' AND (dh.appointdate >= date_add(curdate(), interval -5 year) OR (dh.appointdate < date_add(curdate(), interval -5 year) AND dh.appointdate > date_add(curdate(), interval -6 year)))";
$result4 = $dbObj->execQuery($sql);
$rs4 = $dbObj->fetchArray($result4);
$dbObj->freeresult($result4);
echo $rs4['num4'];
?>
</a></a></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
//$sql = " SELECT COUNT(dh.levelcode) AS num5 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and (dh.statusId='1' Or dh.statusId='3' ) and datediff('".((date('Y')).date('-m-d'))."',appointdate) >=3650 ";
$sql = "SELECT count(*) as num5 FROM dev_hrperson dh, dev_clevelpos dc WHERE dc.levelcode = dh.levelcode AND dh.fperson = 1 AND ((appointdate <= date_add(curdate(), interval -6 year) AND dh.appointdate != '0000-00-00' AND dh.appointdate >= date_add(curdate(), interval -10 year)) OR (dh.appointdate < date_add(curdate(), interval -10 year) AND dh.appointdate > date_add(curdate(), interval -11 year)))";
$result5 = $dbObj->execQuery($sql);
$rs5 = $dbObj->fetchArray($result5);
echo $rs5['num5'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
//$sql = " SELECT COUNT(dh.levelcode) AS num5 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and (dh.statusId='1' Or dh.statusId='3' ) and datediff('".((date('Y')).date('-m-d'))."',appointdate) >=5475 ";
$sql = "SELECT count(*) as num5 FROM dev_hrperson dh, dev_clevelpos dc WHERE dc.levelcode = dh.levelcode AND dh.fperson = 1 AND (dh.statusId = 1 OR dh.statusId = 3) AND dh.appointdate != '0000-00-00' AND ((appointdate <= date_add(curdate(), interval -11 year) AND dh.appointdate >= date_add(curdate(), interval -15 year)) OR (dh.appointdate < date_add(curdate(), interval -15 year) AND dh.appointdate > date_add(curdate(), interval -16 year)))";
$result5 = $dbObj->execQuery($sql);
$rs5 = $dbObj->fetchArray($result5);
echo $rs5['num5'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
//$sql = " SELECT COUNT(dh.levelcode) AS num5 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and (dh.statusId='1' Or dh.statusId='3' ) and datediff('".((date('Y')).date('-m-d'))."',appointdate) <=7300 ";
$sql = "SELECT count(*) as num5 FROM dev_hrperson dh, dev_clevelpos dc WHERE dc.levelcode = dh.levelcode AND dh.fperson = 1 AND (dh.statusId = 1 OR dh.statusId = 3) AND dh.appointdate != '0000-00-00' AND (dh.appointdate <= date_add(curdate(), interval -16 year) AND dh.appointdate >= date_add(curdate(), interval -20 year))";
$result5 = $dbObj->execQuery($sql);
$rs5 = $dbObj->fetchArray($result5);
echo $rs5['num5'];
?></td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5"><?php
//$sql = " SELECT COUNT(dh.levelcode) AS num5 FROM dev_clevelpos dc, dev_hrperson dh Where dc.levelcode =dh.levelcode and (dh.statusId='1' Or dh.statusId='3' ) and datediff('".((date('Y')).date('-m-d'))."',appointdate) >=7300 ";
$sql = "SELECT count(*) as num5 FROM dev_hrperson dh, dev_clevelpos dc WHERE dc.levelcode = dh.levelcode AND dh.fperson = 1 AND (dh.statusId = 1 OR dh.statusId = 3) AND dh.appointdate != '0000-00-00' AND dh.appointdate < date_add(curdate(), interval -20 year)";
$result5 = $dbObj->execQuery($sql);
$rs5 = $dbObj->fetchArray($result5);
echo $rs5['num5'];
?></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td><img src="images/icons/folder-open-doc-text.png" width="16" height="16" border="0" align="absmiddle" /> ประเภทบุคลากรประจำที่มีการพัฒนาตามสรรถนะหลักของ กพ.</td>
<td align="right">เลือกปีงบประมาณ
<select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)">
<option>
<?php
$strSQL = " SELECT * FROM project_year ORDER by Budget_Year asc ";
$result4 = mysql_query($strSQL);
while( $rs4 = mysql_fetch_array($result4) ) {
?>
</option>
<option value="SumPesonal.php?Year_std=<?=$rs4['Budget_Year'];?>" <?php if( $rs4['Budget_Year']==$Year_std ) echo 'selected'; ?>>
<?=$rs4['Budget_Year'];?>
</option>
<?php
} # while
?>
</select></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><table width="97%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF" style="background-color:#eeeeee; border:0px solid gray">
<tr bgcolor="<?=$bgColor;?>">
<td width="3%" height="22" align="center" bgcolor="#6699FF">No</td>
<td width="23%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">รายการ </td>
<td width="8%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">การมุ่งผล<br />
สัมฤทธิ์ </td>
<td width="11%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">การบริการที่ดี </td>
<td width="17%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">การสั่งสมความ<br />
เชี่ยวชาญในงานอาชีพ</td>
<td width="9%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">จริยธรรม</td>
<td width="8%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">การทำงาน<br />
เป็นทีม</td>
<td width="8%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">จำนวน</td>
<td width="13%" align="center" bgcolor="#6699FF" class="PADDING-LEFT-5">ร้อยละการมุ่งผล</br>สัมฤทธิ์</td>
</tr>
<?php
$sql = " SELECT * FROM dev_cfperson Where fperson !=0 " ;
$result9 = $dbObj->execQuery($sql);
$no = 1+($display-1)*$limit;
while( $rss13 = $dbObj->fetchArray($result9) ) {
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" align="center" bgcolor="#FFFFFF"><?=$no;?></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?=$rss13['fpersonmn'];?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sql = " SELECT COUNT( num ) AS num1 FROM (SELECT COUNT( dp.perid ) AS num FROM dev_hrperson dp, dev_his dh WHERE dp.perid = dh.perid AND dp.statusId = '1' AND dp.fperson = '$rss13[fperson]' AND dh.cdevcode = '101' AND (dh.Training_std = 'N' OR dh.Training_std = 'Y') AND dh.Year_std = '$Year_std' GROUP BY dh.perid) Temp ";
$result19 = $dbObj->execQuery($sql);
$rs19 = $dbObj->fetchArray($result19);
echo $rs19['num1'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT( num ) AS num1 FROM (SELECT COUNT(dp.perid) AS num FROM dev_hrperson dp, dev_his dh WHERE dp.perid = dh.perid and dp.statusId ='1' and dp.fperson='$rss13[fperson]' and dh.cdevcode ='102' and (dh.Training_std ='N' Or dh.Training_std ='Y' ) and dh.Year_std ='$Year_std' Group By dh.perid) Temp ";
$result12 = $dbObj->execQuery($sql);
$rs12 = $dbObj->fetchArray($result12);
echo $rs12['num1'];
?> </a><a href="PersonalDataType.php?StatusId=3&Person_type=<?=$rss3['Ptype_code'];?>"></a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$sql = " SELECT COUNT( num ) AS num1 FROM (SELECT COUNT(dp.perid) AS num FROM dev_hrperson dp, dev_his dh WHERE dp.perid = dh.perid and dp.statusId ='1' and dp.fperson='$rss13[fperson]' and dh.cdevcode ='103' and (dh.Training_std ='N' Or dh.Training_std ='Y' ) and dh.Year_std ='$Year_std' Group By dh.perid) Temp ";
$result13 = $dbObj->execQuery($sql);
$rs13 = $dbObj->fetchArray($result13);
echo $rs13['num1'];
?>
</a></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT( num ) AS num1 FROM (SELECT COUNT(dp.perid) AS num FROM dev_hrperson dp, dev_his dh WHERE dp.perid = dh.perid and dp.statusId ='1' and dp.fperson='$rss13[fperson]' and dh.cdevcode ='104' and (dh.Training_std ='N' Or dh.Training_std ='Y' ) and dh.Year_std ='$Year_std' Group By dh.perid) Temp ";
$result14 = $dbObj->execQuery($sql);
$rs14 = $dbObj->fetchArray($result14);
echo $rs14['num1'];
?></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT( num ) AS num1 FROM (SELECT COUNT(dp.perid) AS num FROM dev_hrperson dp, dev_his dh WHERE dp.perid = dh.perid and dp.statusId ='1' and dp.fperson='$rss13[fperson]' and dh.cdevcode ='105' and (dh.Training_std ='N' Or dh.Training_std ='Y' ) and dh.Year_std ='$Year_std' Group By dh.perid) Temp ";
$result15 = $dbObj->execQuery($sql);
$rs15 = $dbObj->fetchArray($result15);
echo $rs15['num1'];
?></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5"><?php
$sql = " SELECT COUNT(perid) AS num1 FROM dev_hrperson WHERE statusId ='1' and fperson='$rss13[fperson]' ";
$result16 = $dbObj->execQuery($sql);
$rs16 = $dbObj->fetchArray($result16);
echo $rs16['num1'];
?></td>
<td align="center" bgcolor="#FFFFFF" class="PADDING-LEFT-5">
<?php
$per1 = ($rs19['num1']*100)/$rs16['num1'];
echo number_format($per1,'2','.','')." %";
?> </td>
<?php
$sum1 += $rs19['num1'];
$sum2 += $rs12['num1'];
$sum3 += $rs13['num1'];
$sum4 += $rs14['num1'];
$sum5 += $rs15['num1'];
$sum6 += $rs16['num1'];
$no++ ;
} # while
?>
</tr>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" align="center" bgcolor="#FFCCFF"> </td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5">สรุป</td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5">
<?
echo $sum1;
?> </td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5">
<?
echo $sum2;
?> </td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5">
<?
echo $sum3;
?> </td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5">
<?
echo $sum4;
?> </td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5">
<?
echo $sum5;
?> </td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5">
<?
echo $sum6;
?> </td>
<td align="center" bgcolor="#FFCCFF" class="PADDING-LEFT-5">
<?
$per2 = ($sum1*100)/$sum6;
echo number_format($per2,'2','.','')." %";
?> </td>
</tr>
<tr bgcolor="<?=$bgColor;?>">
<td height="22" align="center" bgcolor="#FF99CC"> </td>
<td align="center" bgcolor="#FF99CC" class="PADDING-LEFT-5">สัดส่วน</td>
<td align="center" bgcolor="#FF99CC" class="PADDING-LEFT-5">
<?
$per3 = ($sum1*100)/$sum6;
echo number_format($per3,'2','.','')." %";
?> </td>
<td align="center" bgcolor="#FF99CC" class="PADDING-LEFT-5">
<?
$per4 = ($sum2*100)/$sum6;
echo number_format($per4,'2','.','')." %";
?> </td>
<td align="center" bgcolor="#FF99CC" class="PADDING-LEFT-5">
<?
$per5 = ($sum3*100)/$sum6;
echo number_format($per5,'2','.','')." %";
?> </td>
<td align="center" bgcolor="#FF99CC" class="PADDING-LEFT-5">
<?
$per6 = ($sum4*100)/$sum6;
echo number_format($per6,'2','.','')." %";
?> </td>
<td align="center" bgcolor="#FF99CC" class="PADDING-LEFT-5">
<?
$per7 = ($sum5*100)/$sum6;
echo number_format($per7,'2','.','')." %";
?> </td>
<td align="center" bgcolor="#FF99CC" class="PADDING-LEFT-5"> </td>
<td align="center" bgcolor="#FF99CC" class="PADDING-LEFT-5"> </td>
</tr>
</table></td>
</tr></form>
</table>
</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);
?>
|