Viewing file: detailperfi.php (13.41 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include 'include/controllerAc.php';
$YearCount=$_GET['YearCount'];
$id=$_GET['id'];
$case=$_GET['case'];
$no=1;
//จำนวนชั่วโมงวิชาการ(พัฒนาภายใน)
if($case==1){
$query1 = "SELECT * FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND ac_hour_in<>0 ";
$result1 = $conn->query($query1);
$query3 = "SELECT SUM(ac_hour_in) AS to1,SUM(ac_hour_outbudget) AS to2,SUM(ac_hour_out) AS to3,SUM(pr_hour_in) AS to4,SUM(pr_hour_outbudget) AS to5,SUM(pr_hour_out) AS to6,SUM(moral_hour_in) AS to7,SUM(moral_hour_outbudget) AS to8,SUM(moral_hour_out) AS to9
FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND ac_hour_in<>0 ";
$result3 = $conn->query($query3);
while($values1 = $result3->fetch_assoc()){$sumAll=($values1['to1']+$values1['to2']+$values1['to3']+$values1['to4']+$values1['to5']+$values1['to6']+$values1['to7']+$values1['to8']+$values1['to9']);}
}
//จำนวนชั่วโมงวิชาชีพ(พัฒนาภายใน)
if($case==2){
$query1 = "SELECT * FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND pr_hour_in<>0 ";
$result1 = $conn->query($query1);
$query3 = "SELECT SUM(ac_hour_in) AS to1,SUM(ac_hour_outbudget) AS to2,SUM(ac_hour_out) AS to3,SUM(pr_hour_in) AS to4,SUM(pr_hour_outbudget) AS to5,SUM(pr_hour_out) AS to6,SUM(moral_hour_in) AS to7,SUM(moral_hour_outbudget) AS to8,SUM(moral_hour_out) AS to9
FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND pr_hour_in<>0 ";
$result3 = $conn->query($query3);
while($values1 = $result3->fetch_assoc()){$sumAll=($values1['to1']+$values1['to2']+$values1['to3']+$values1['to4']+$values1['to5']+$values1['to6']+$values1['to7']+$values1['to8']+$values1['to9']);}
}
//จำนวนชั่วโมงคุณธรรมจริยธรรม(พัฒนาภายใน)
if($case==3){
$query1 = "SELECT * FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND moral_hour_in<>0 ";
$result1 = $conn->query($query1);
$query3 = "SELECT SUM(ac_hour_in) AS to1,SUM(ac_hour_outbudget) AS to2,SUM(ac_hour_out) AS to3,SUM(pr_hour_in) AS to4,SUM(pr_hour_outbudget) AS to5,SUM(pr_hour_out) AS to6,SUM(moral_hour_in) AS to7,SUM(moral_hour_outbudget) AS to8,SUM(moral_hour_out) AS to9
FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND moral_hour_in<>0 ";
$result3 = $conn->query($query3);
while($values1 = $result3->fetch_assoc()){$sumAll=($values1['to1']+$values1['to2']+$values1['to3']+$values1['to4']+$values1['to5']+$values1['to6']+$values1['to7']+$values1['to8']+$values1['to9']);}
}
//จำนวนชั่วโมงวิชาการ(พัฒนาภายนอก) ใช้งบ
if($case==4){
$query1 = "SELECT * FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND ac_hour_outbudget<>0 AND ac_money<>0 ";
$result1 = $conn->query($query1);
$query3 = "SELECT SUM(ac_hour_in) AS to1,SUM(ac_hour_outbudget) AS to2,SUM(ac_hour_out) AS to3,SUM(pr_hour_in) AS to4,SUM(pr_hour_outbudget) AS to5,SUM(pr_hour_out) AS to6,SUM(moral_hour_in) AS to7,SUM(moral_hour_outbudget) AS to8,SUM(moral_hour_out) AS to9
FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND ac_hour_outbudget<>0 AND ac_money<>0 ";
$result3 = $conn->query($query3);
while($values1 = $result3->fetch_assoc()){$sumAll=($values1['to1']+$values1['to2']+$values1['to3']+$values1['to4']+$values1['to5']+$values1['to6']+$values1['to7']+$values1['to8']+$values1['to9']);}
}
//จำนวนชั่วโมงวิชาชีพ(พัฒนาภายนอก) ใช้งบ
if($case==5){
$query1 = "SELECT * FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND pr_hour_outbudget<>0 AND pr_money<>0 ";
$result1 = $conn->query($query1);
$query3 = "SELECT SUM(ac_hour_in) AS to1,SUM(ac_hour_outbudget) AS to2,SUM(ac_hour_out) AS to3,SUM(pr_hour_in) AS to4,SUM(pr_hour_outbudget) AS to5,SUM(pr_hour_out) AS to6,SUM(moral_hour_in) AS to7,SUM(moral_hour_outbudget) AS to8,SUM(moral_hour_out) AS to9
FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND pr_hour_outbudget<>0 AND pr_money<>0 ";
$result3 = $conn->query($query3);
while($values1 = $result3->fetch_assoc()){$sumAll=($values1['to1']+$values1['to2']+$values1['to3']+$values1['to4']+$values1['to5']+$values1['to6']+$values1['to7']+$values1['to8']+$values1['to9']);}
}
//จำนวนชั่วโมงคุณธรรมจริยธรรม(พัฒนาภายนอก) ใช้งบ
if($case==6){
$query1 = "SELECT * FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND moral_hour_outbudget<>0 AND moral_money<>0 ";
$result1 = $conn->query($query1);
$query3 = "SELECT SUM(ac_hour_in) AS to1,SUM(ac_hour_outbudget) AS to2,SUM(ac_hour_out) AS to3,SUM(pr_hour_in) AS to4,SUM(pr_hour_outbudget) AS to5,SUM(pr_hour_out) AS to6,SUM(moral_hour_in) AS to7,SUM(moral_hour_outbudget) AS to8,SUM(moral_hour_out) AS to9
FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND moral_hour_outbudget<>0 AND moral_money<>0 ";
$result3 = $conn->query($query3);
while($values1 = $result3->fetch_assoc()){$sumAll=($values1['to1']+$values1['to2']+$values1['to3']+$values1['to4']+$values1['to5']+$values1['to6']+$values1['to7']+$values1['to8']+$values1['to9']);}
}
//จำนวนชั่วโมงวิชาการ(พัฒนาภายนอกไม่ใช้งบ)
if($case==7){
$query1 = "SELECT * FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND ac_hour_out<>0 ";
$result1 = $conn->query($query1);
$query3 = "SELECT SUM(ac_hour_in) AS to1,SUM(ac_hour_outbudget) AS to2,SUM(ac_hour_out) AS to3,SUM(pr_hour_in) AS to4,SUM(pr_hour_outbudget) AS to5,SUM(pr_hour_out) AS to6,SUM(moral_hour_in) AS to7,SUM(moral_hour_outbudget) AS to8,SUM(moral_hour_out) AS to9
FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND ac_hour_out<>0 ";
$result3 = $conn->query($query3);
while($values1 = $result3->fetch_assoc()){$sumAll=($values1['to1']+$values1['to2']+$values1['to3']+$values1['to4']+$values1['to5']+$values1['to6']+$values1['to7']+$values1['to8']+$values1['to9']);}
}
//จำนวนชั่วโมงวิชาชีพ(พัฒนาภายนอกไม่ใช้งบ)
if($case==8){
$query1 = "SELECT * FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND pr_hour_out<>0 ";
$result1 = $conn->query($query1);
$query3 = "SELECT SUM(ac_hour_in) AS to1,SUM(ac_hour_outbudget) AS to2,SUM(ac_hour_out) AS to3,SUM(pr_hour_in) AS to4,SUM(pr_hour_outbudget) AS to5,SUM(pr_hour_out) AS to6,SUM(moral_hour_in) AS to7,SUM(moral_hour_outbudget) AS to8,SUM(moral_hour_out) AS to9
FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND pr_hour_out<>0 ";
$result3 = $conn->query($query3);
while($values1 = $result3->fetch_assoc()){$sumAll=($values1['to1']+$values1['to2']+$values1['to3']+$values1['to4']+$values1['to5']+$values1['to6']+$values1['to7']+$values1['to8']+$values1['to9']);}
}
//จำนวนชั่วโมงคุณธรรมจริยธรรม(พัฒนาภายนอกไม่ใช้งบ)
if($case==9){
$query1 = "SELECT * FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND moral_hour_out<>0 ";
$result1 = $conn->query($query1);
$query3 = "SELECT SUM(ac_hour_in) AS to1,SUM(ac_hour_outbudget) AS to2,SUM(ac_hour_out) AS to3,SUM(pr_hour_in) AS to4,SUM(pr_hour_outbudget) AS to5,SUM(pr_hour_out) AS to6,SUM(moral_hour_in) AS to7,SUM(moral_hour_outbudget) AS to8,SUM(moral_hour_out) AS to9
FROM v_report WHERE fiyear='$YearCount' AND personCode=$id AND moral_hour_out<>0 ";
$result3 = $conn->query($query3);
while($values1 = $result3->fetch_assoc()){$sumAll=($values1['to1']+$values1['to2']+$values1['to3']+$values1['to4']+$values1['to5']+$values1['to6']+$values1['to7']+$values1['to8']+$values1['to9']);}
}
$query2 = "SELECT * FROM persontb WHERE personCode=$id ";
$result2 = $conn->query($query2);
while($values = $result2->fetch_assoc()){$name=$values['name']." ".$values['surName'];}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Niramit&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Niramit', sans-serif;
font-size: 12px;
}
</style>
</head>
<body>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th colspan="13"><center>ข้อมูลจำนวนชั่วโมงวิชาการวิชาชีพและคุณธรรมจริยธรรม จำแนกตามปีการศึกษา <?=$YearCount?> ของ <?=$name?></center></th>
</tr>
<tr>
<th class="text-center" width="5%">ครั้งที่</th>
<th class="text-left" width="30%">ชื่อโครงการที่เข้าร่วม</th>
<th class="text-center">เริ่มต้น</th>
<th class="text-center">สิ้นสุด</th>
<th class="text-center">ชม.วก.</th>
<th class="text-center">ชม.วช.</th>
<th class="text-center">ชม.คธ.</th>
<th class="text-right">เงิน วก.</th>
<th class="text-right">เงิน วช.</th>
<th class="text-right">เงิน คธ.</th>
<th class="text-right">รวมเงิน</th>
<th class="text-center">รวมชั่วโมง</th>
<th class="text-center">% รายโครงการ</th>
</tr>
</thead>
<tbody>
<?php
$no=1;
$sumary1=0;
$sumary2=0;
$sumary3=0;
$sumary4=0;
$sumary5=0;
$sumary6=0;
$sumary7=0;
$sumary8=0;
while($res1 = $result1->fetch_assoc()){
?>
<tr>
<td class="text-center"><?=$no?></td>
<td class="text-left"><?=$res1['projectName']?></td>
<td class="text-center"><?=DateThai($res1['start'])?></td>
<td class="text-center"><?=DateThai($res1['end'])?></td>
<td class="text-center"><?=number_format($res1['ac_hour_in']+$res1['ac_hour_outbudget']+$res1['ac_hour_out'])?></td>
<td class="text-center"><?=number_format($res1['pr_hour_in']+$res1['pr_hour_outbudget']+$res1['pr_hour_out'])?></td>
<td class="text-center"><?=number_format($res1['moral_hour_in']+$res1['moral_hour_outbudget']+$res1['moral_hour_out'])?></td>
<td class="text-right"><?=number_format($res1['ac_money'])?></td>
<td class="text-right"><?=number_format($res1['pr_money'])?></td>
<td class="text-right"><?=number_format($res1['moral_money'])?></td>
<td class="text-right"><?=number_format(($res1['ac_money']+$res1['pr_money']+$res1['moral_money']),2)?></td>
<td class="text-center"><?=number_format(($res1['ac_hour_in']+$res1['ac_hour_outbudget']+$res1['ac_hour_out']+$res1['pr_hour_in']+$res1['pr_hour_outbudget']+$res1['pr_hour_out']+$res1['moral_hour_in']+$res1['moral_hour_outbudget']+$res1['moral_hour_out']),2)?></td>
<td class="text-center"><?=number_format((($res1['ac_hour_in']+$res1['ac_hour_outbudget']+$res1['ac_hour_out']+$res1['pr_hour_in']+$res1['pr_hour_outbudget']+$res1['pr_hour_out']+$res1['moral_hour_in']+$res1['moral_hour_outbudget']+$res1['moral_hour_out'])/$sumAll)*100,2)?>%</td>
</tr>
<?php
$no++;
$sumary1+=$res1['ac_hour_in']+$res1['ac_hour_outbudget']+$res1['ac_hour_out'];
$sumary2+=$res1['pr_hour_in']+$res1['pr_hour_outbudget']+$res1['pr_hour_out'];
$sumary3+=$res1['moral_hour_in']+$res1['moral_hour_outbudget']+$res1['moral_hour_out'];
$sumary4+=$res1['ac_money'];
$sumary5+=$res1['pr_money'];
$sumary6+=$res1['moral_money'];
$sumary7+=($res1['ac_money']+$res1['pr_money']+$res1['moral_money']);
$sumary8+=($res1['ac_hour_in']+$res1['ac_hour_outbudget']+$res1['ac_hour_out']+$res1['pr_hour_in']+$res1['pr_hour_outbudget']+$res1['pr_hour_out']+$res1['moral_hour_in']+$res1['moral_hour_outbudget']+$res1['moral_hour_out']);
}
?>
<tr>
<td class="text-right" colspan="4"><b>รวมทั้งหมด</b></td>
<td class="text-center"><?=number_format($sumary1,2)?></td>
<td class="text-right"><?=number_format($sumary2,2)?></td>
<td class="text-right"><?=number_format($sumary3,2)?></td>
<td class="text-right"><?=number_format($sumary4,2)?></td>
<td class="text-right"><?=number_format($sumary5,2)?></td>
<td class="text-right"><?=number_format($sumary6,2)?></td>
<td class="text-right"><?=number_format($sumary7,2)?></td>
<td class="text-center"><?=number_format($sumary8,2)?></td>
<td class="text-center"></td>
</tr>
</tbody>
</table>
</body>
</html>
<?php
function DateThai($strDate)
{
$strYear = date("Y",strtotime($strDate))+543;
$strMonth= date("n",strtotime($strDate));
$strDay= date("j",strtotime($strDate));
$strHour= date("H",strtotime($strDate));
$strMinute= date("i",strtotime($strDate));
$strSeconds= date("s",strtotime($strDate));
$strMonthCut = Array("","ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
$strMonthThai=$strMonthCut[$strMonth];
return "$strDay $strMonthThai $strYear";
}
?>
|