Viewing file: detailperfi.php (5.75 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("classes/Crud.php");
$crud = new Crud();
$YearCount=$_GET['YearCount'];
$id=$_GET['id'];
$no=1;
$query1 = "SELECT * FROM v_report WHERE fiyear='$YearCount' AND personCode=$id ";
$result1 = $crud->getData($query1);
$query2 = "SELECT * FROM persontb WHERE personCode=$id ";
$result2 = $crud->getData($query2);
foreach($result2 as $key => $res2){$name=$res2['name']." ".$res2['surName'];}
$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 ";
$result3 = $crud->getData($query3);
foreach($result3 as $key => $res3){$sumAll=($res3['to1']+$res3['to2']+$res3['to3']+$res3['to4']+$res3['to5']+$res3['to6']+$res3['to7']+$res3['to8']+$res3['to9']);}
?>
<!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="stylesheet"
href="https://fonts.googleapis.com/css?family=Tangerine">
<style>
body {
font-family: 'Kanit', sans-serif;
font-size: 13px;
}
</style>
</head>
<body>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th colspan="11"><center>รายงานผลบุคลากรที่ได้รับการพัฒนาทางวิชาการและวิชาชีพรายโครงการ จำแนกตามปีการศึกษา <?=$YearCount?><br> ของ <?=$name?></center></th>
</tr>
<tr>
<th class="text-center">ครั้งที่</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-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;
foreach($result1 as $key => $res1){
?>
<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-right"><?=number_format($res1['ac_money'])?></td>
<td class="text-right"><?=number_format($res1['pr_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-right"><?=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']);
$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']);
}
?>
<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($sumary4,2)?></td>
<td class="text-right"><?=number_format($sumary5,2)?></td>
<td class="text-right"><?=number_format($sumary7,2)?></td>
<td class="text-right"><?=number_format($sumary8,2)?></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";
}
?>
|