<?php

include("../include/FunctionDB.php");
include(
"admin_menu.php");
include(
"../include/Function.php");
ConnectDB();
$strSQL "SELECT * FROM faculty_tb";
$result mysql_query($strSQL); 
$total mysql_num_rows$result );
?> 

<meta http-equiv="Content-Type" content="text/html; charset=TIS-620">
<link href="./source/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
    font-size: 14px;
    font-weight: bold;
}
.style2 {font-size: 14px}
.style6 {font-size: 12px; font-family: Tahoma; }
.style7 {font-size: 12px}
-->
</style>
<table width="816" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="816" ><br> 
          <fieldset>
            <legend><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><a href="menu_manage.php">หน้าหลัก</a><a href="menuEdu.php"></a> <img src="../picture/ico3.gif" width="10" height="10" border="0" align="absmiddle"> จำนวนบุคลากรตามภาค/ฝ่าย</font></legend>
            <label>
  <form id="form1" name="form1" method="post" action="">
    <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC" style="border:0px solid gray">
      <tr bgcolor="#DBE4E9">
        <td height="25" colspan="7" bgcolor="#FFFFFF"><font size="2" face="Tahoma"><img src="../picture/previous.gif" onclick="window.history.back()"  width="85" height="22" border="0" /></font></td>
      </tr>
      <tr bgcolor="#DBE4E9">
        <td height="25" colspan="7" bgcolor="#FFFFFF"><div align="center" class="style1"><font color="#9966FF" face="Tahoma">จำนวนบุคลาการจำแนกตามหน่วยงาน</font></div></td>
      </tr>
      <tr bgcolor="#CCCCCC">
        <td width="21" height="21" align="center" bgcolor="#9999FF"><span class="style2"><font color="#000000" face="Tahoma">No</font></span></td>
        <td width="72" align="center" bgcolor="#9999FF"><span class="style6"><font color="<?php echo $GLOBALS["COLOR_FONT_3"];?>">รหัสหน่วยงาน</font></span></td>
        <td width="338" align="center" bgcolor="#9999FF"><span class="style7"><font color="#000000" face="Tahoma">ชื่อหน่วยงาน</font></span></td>
        <td width="84" align="center" bgcolor="#CCCCFF"><span class="style6"><font color="#000000">จำนวนข้าราชการ<br />
        </font></span></td>
        <td width="97" align="center" bgcolor="#CC99FF"><span class="style6"><font color="#000000">จำนวนลูกจ้างประจำ<br />
        </font></span></td>
        <td width="104" align="center" bgcolor="#99CCFF"><span class="style6"><font color="#000000">จำนวนลูกจ้างชั่วคราว<br />
        </font></span></td>
        <td width="110" align="center" bgcolor="#CCCCFF"><span class="style6"><font color="#000000">จำนวนบุคลากรทั้งหมด</font></span></td>
      </tr>
      <?php
$i 
1;
 while(
$row mysql_fetch_array($result))
 {

     if(
$count==0)
     {
?>
      <tr bordercolor="#CCCCCC" bgcolor="#EEEEEE" onmouseover="this.style.backgroundColor='#FCFCF3'" onmouseout="this.style.backgroundColor='#EEEEEE'" >
        <td align="center" bgcolor="#EBFAFE" ><font color="#000000" size="2" face="Tahoma">
          <?=$i?>
        </font></td>
        <td align="center" bgcolor="#EBFAFE" ><font color="#0033CC" size="2" face="Tahoma">
          <?=$row["Faculty_code"]?>
        </a></font></td>
        <td align="center" bgcolor="#EBFAFE" ><div align="left">
          <div align="left">
          <div align="left">
          <div align="left"><font color="#0033CC" size="2" face="Tahoma"><a href="PersonFacList.php?Faculty_code=<?=$row["Faculty_code"]?>" title="Click to see Detail"class="d" >
            <?=$row["Faculty_name"]?>
            </a></font></div>
          <div align="left"></td>
        <td align="center" bgcolor="#EBFAFE" ><strong><font color="#0033CC" size="2" face="Tahoma">
          <?php
      $Faculty_code 
$row[Faculty_code];
      
$sql1 "Select * From personal_tb Where Faculty_code='$Faculty_code' and  StatusId='1'   and   Person_type='1' ";
      
$result1 mysql_query($sql1) or die("Error".mysql_error()); 
      
$rss mysql_fetch_array($result1);
      
$num mysql_num_rows($result1);
       echo 
"$num";
      
?>
          </a></font></strong></td>
        <td align="center" bgcolor="#EBFAFE" ><strong><font color="#0033CC" size="2" face="Tahoma">
          <?php
      $Faculty_code 
$row[Faculty_code];
      
$sql1 "Select * From personal_tb Where Faculty_code='$Faculty_code' and   StatusId='1'   and  Person_type='3' ";
      
$result1 mysql_query($sql1) or die("Error".mysql_error()); 
      
$rss mysql_fetch_array($result1);
      
$num mysql_num_rows($result1);
       echo 
"$num";
      
?>
          </a></font></strong></td>
        <td align="center" bgcolor="#EBFAFE" ><strong><font color="#0033CC" size="2" face="Tahoma">
        <?php
      $Faculty_code 
$row[Faculty_code];
      
$sql1 "Select * From personal_tb Where Faculty_code='$Faculty_code' and   StatusId='1'   and   Person_type='4' ";
      
$result1 mysql_query($sql1) or die("Error".mysql_error()); 
      
$rss mysql_fetch_array($result1);
      
$num mysql_num_rows($result1);
       echo 
"$num";
      
?>
        </a></font></strong></td>
        <td align="center" bgcolor="#EBFAFE" ><strong><font color="#0033CC" size="2" face="Tahoma"><a href="PersonFacList.php?Faculty_code=<?=$row["Faculty_code"]?>"title="Click to see Detail"class="d" >
          <?php
      $Faculty_code 
$row[Faculty_code];
      
$sql1 "Select * From personal_tb Where Faculty_code='$Faculty_code'  and   StatusId='1'   ";
      
$result1 mysql_query($sql1) or die("Error".mysql_error()); 
      
$rss mysql_fetch_array($result1);
      
$num mysql_num_rows($result1);
       echo 
"$num";
      
?>
        </a>&nbsp;&nbsp;&nbsp;<font color="#000000">คน</font></font></strong></td>
      </tr>
      <?
    $count
=1;
     }
else
{
?>
      <tr bordercolor="#CCCCCC" bgcolor="#FFFFFF" onmouseover="this.style.backgroundColor='#FCFCF3'" onmouseout="this.style.backgroundColor='#FFFFFF'">
        <td align="center" ><font color="#000000" size="2" face="Tahoma">
          <?=$i?>
        </font></td>
        <td align="center" ><font color="#0033CC" size="2" face="Tahoma">
          <?=$row["Faculty_code"]?>
        </a></font></td>
        <td height="18" align="center" ><div align="left">
          <div align="left">
          <div align="left"><font color="#0033CC" size="2" face="Tahoma"><a href="PersonFacList.php?Faculty_code=<?=$row["Faculty_code"]?>" title="Click to see Detail"class="d" >
            <?=$row["Faculty_name"]?>
            </a></font></div></td>
        <td align="center" ><font color="#0033CC" size="2" face="Tahoma">
          <?php
      $Faculty_code 
$row[Faculty_code];
      
$sql1 "Select * From personal_tb Where Faculty_code='$Faculty_code' and  StatusId='1'  and  Person_type='1' ";
      
$result1 mysql_query($sql1) or die("Error".mysql_error()); 
      
$rss mysql_fetch_array($result1);
      
$num mysql_num_rows($result1);
       echo 
"$num";
      
?>
        </a></font></td>
        <td align="center" ><font color="#0033CC" size="2" face="Tahoma">
          <?php
      $Faculty_code 
$row[Faculty_code];
      
$sql1 "Select * From personal_tb Where Faculty_code='$Faculty_code'   and   StatusId='1'   and   Person_type='3' ";
      
$result1 mysql_query($sql1) or die("Error".mysql_error()); 
      
$rss mysql_fetch_array($result1);
      
$num mysql_num_rows($result1);
       echo 
"$num";
      
?>
        </a></font></td>
        <td align="center" ><font color="#0033CC" size="2" face="Tahoma">
          <?php
      $Faculty_code 
$row[Faculty_code];
      
$sql1 "Select * From personal_tb Where Faculty_code='$Faculty_code' and   StatusId='1'   and   Person_type='4' ";
      
$result1 mysql_query($sql1) or die("Error".mysql_error()); 
      
$rss mysql_fetch_array($result1);
      
$num mysql_num_rows($result1);
       echo 
"$num";
      
?>
        </a></font></td>
        <td align="center" ><font color="#0033CC" size="2" face="Tahoma"><a href="PersonFacList.php?Faculty_code=<?=$row["Faculty_code"]?>"title="Click to see Detail"class="d" >
          <?php
      $Faculty_code 
$row[Faculty_code];
      
$sql1 "Select * From personal_tb Where Faculty_code='$Faculty_code' and   StatusId='1'    ";
      
$result1 mysql_query($sql1) or die("Error".mysql_error()); 
      
$rss mysql_fetch_array($result1);
      
$num mysql_num_rows($result1);
       echo 
"$num";
      
?>
        </a>&nbsp;&nbsp;&nbsp;<font color="#000000">คน</font></font></td>
      </tr>
      <?
$count
=0;
}
$i++;
 }    
CloseDB();
?>
      <tr bgcolor="#DBE4E9">
        <td colspan="7" align="center" bgcolor="#FFFFFF"><div align="center"><span class="style2"><font color="#000000" face="Tahoma">ทั้งหมด</font></span><font color="#000000" size="2" face="Tahoma"><strong> <? echo $total ?> </strong></font><span class="style2"><font color="#000000" face="Tahoma">รายการ&nbsp;</font></span> </div></td>
      </tr>
    </table>
  </form>
          </fieldset>
        <br>
        <font color="<?php echo $GLOBALS["COLOR_FONT_3"];?>" size="2"><b>หมายเหตุ :</b> ใช้เมาส์คลิกที่ชื่อ<br>
      </font></td>
    </tr>
</table>