<link href="https://fonts.googleapis.com/css?family=Sarabun&display=swap" rel="stylesheet">
<link rel="stylesheet" href="modules/idocument/css/dataTables.bootstrap.min.css">
<?php
/** ensure this file is being included by a parent file */
defined( '_VALID_' ) or die( 'Direct Access to this location is not allowed.' );
foreach($_REQUEST as $key=>$value)
{
$$key=$value;
}
?>
<br>
<div class="container">
<div class="panel panel-warning">
<div class="panel-heading">
<h3 class="panel-title"><span class='glyphicon glyphicon-list-alt' aria-hidden='true'> </span> รายการบันทึกเสนอ</h3>
</div>
<div class="panel-body">
<table class="table table-hover table-striped" id="data1">
<thead>
<tr>
<th width="5%">ที่</th>
<th>เลขที่</th>
<th width="3%"></th>
<th width="40%">เรื่อง</th>
<th width="25%">เรียน</th>
<th width="10%">ดำเนินการ</th>
<th>สถานะ</th>
</tr>
</thead>
<tbody>
<?php
//บุคลากรเขต
$user=$_SESSION['login_user_id'];
$sql_person = "select * from person_main where person_id='$user'";
$dbquery_person = mysqli_query($connect,$sql_person);
$result_person = mysqli_fetch_array($dbquery_person);
$total_pid = mysqli_num_rows($dbquery_person);
$position_code = $result_person['position_code'];
$department = $result_person['department'];
$pic = $result_person['pic'];
$fullname=$result_person['prename'].$result_person['name']." ".$result_person['surname'];
$responsible=$result_person['responsible'];
//หาตำแหน่ง
$sql_position = "select * from person_position where position_code='$position_code' ";
$dbquery_position = mysqli_query($connect,$sql_position);
$result_position = mysqli_fetch_array($dbquery_position);
$position_name = $result_position['position_name'];
//หาหน่วยงาน
$sql_workgroup = "select * from system_workgroup where workgroup='$department' ";
$dbquery_workgroup = mysqli_query($connect,$sql_workgroup);
$result_workgroup = mysqli_fetch_array($dbquery_workgroup);
$g_name = $result_workgroup['workgroup_desc2'];
?>
<?php
$sql = "SELECT * FROM `idocument_main` where officer = '". $_SESSION['login_user_id'] ."' Order By id Desc";
$dbquery = mysqli_query($connect,$sql);
$row = 1;
while($datarow = mysqli_fetch_assoc($dbquery)){
?>
<tr>
<td><?php echo $row;?></td>
<td><?php echo $datarow['book_no'];?></td>
<td>
<?php
$book_type = $datarow['book_type'];
if($book_type == 0){
$type = "<span class='pull-right badge' style='background-color:back;''>ปกติ</span>";
}
if($book_type == 1){
$type = "<span class='pull-right badge' style='background-color:orange;''>ด่วน</span>";
}
if($book_type == 2){
$type = "<span class='pull-right badge' style='background-color:red;''>ด่วนที่สุด</span>";
}
if($book_type == 3){
$type = "<span class='pull-right badge' style='background-color:DeepPink;''>ลับ</span>";
}
echo $type;
?>
</td><td><font face="Sarabun" size='2'><?php echo $datarow['subject'];?><br>
โดย : <?php echo $fullname?><br>กลุ่ม/หน่วย : <?php echo $g_name?></font></td>
<th><font face="Sarabun" size='2'><?php echo $datarow['book_to'];?></font></th>
<th>
<a href="?option=<?php echo $option;?>&task=detail&id=<?php echo $datarow['id'];?>" class="btn btn-info" ><i class="glyphicon glyphicon-search"></i></a>
<!--a href="#" class="btn btn-warning" ><i class="glyphicon glyphicon-menu-right"></i></a-->
<?php
$book_status = $datarow['book_status'];
if($book_status < 2 | $book_status == 99) {
?>
<a href="?option=<?php echo $option;?>&task=edit&id=<?php echo $datarow['id'];?>" class="btn btn-warning" title = "แก้ไข"><i class="glyphicon glyphicon-edit"></i></a>
<?php
}
?>
</th>
<th>
<?php
$pre_doc_id = $datarow['pre_doc_id'];
$book_status = $datarow['book_status'];
if($pre_doc_id == 0){ ?>
<span class="pull-right badge" style="background-color:Back;">ฉบับร่าง</span>
<?php
}
?>
<?php
if($book_status == 0){
$commenttext = "รอดำเนินการ";
$badge = "orange";
}
if($book_status == 1){
$commenttext = "กำลังดำเนินการ";
$badge = "#b783f9";
}
if($book_status == 2){
$commenttext = "รอ รอง ผอ.สพป. ลงนาม";
$badge = "DodgerBlue";
}
if($book_status == 3){
$commenttext = "รอ ผอ.สพป. ลงนาม";
$badge = "DodgerBlue";
}
if($book_status == 40){
$commenttext = "ลงนามแล้ว";
$badge = "green";
}
if($datarow['book_status'] == 4){
$commenttext = "อนุญาต";
$badge = "green";
}
if($datarow['book_status'] == 41){
$commenttext = "อนุญาต/อนุมัติ";
$badge = "green";
}
if($datarow['book_status'] == 5){
$commenttext = "ปฏิบัติราชการ/รักษาการแทน<br> ดำเนินการเสร็จแล้ว";
$badge = "green";
}
if($datarow['book_status'] == 51){
$commenttext = "ไม่อนุญาต/ไม่อนุมัติ";
$badge = "red";
}
if($datarow['book_status'] == 6){
$commenttext = "อนุมัติ";
$badge = "green";
}
if($datarow['book_status'] == 7){
$commenttext = "ไม่อนุมัติ";
$badge = "red";
}
if($datarow['book_status'] == 8){
$commenttext = "ชอบ/ให้ดำเนินการตามเสนอ";
$badge = "green";
}
if($datarow['book_status'] == 99){
$commenttext = "คืนเรื่อง";
$badge = "red";
}
?>
<span class="pull-right badge" style="background-color:<?php echo $badge;?>;"><?php echo $commenttext;?></span>
<?php
$row++;
}
?>
</th>
</tr>
</tbody>
</table>
</div>
<script src="modules/idocument/css/jquery.dataTables.min.js"></script>
<script src="modules/idocument/css/dataTables.bootstrap.min.js"></script>
<script>
$(function () {
$('#data1').DataTable({
"oLanguage": {
"sLengthMenu": "แสดง _MENU_ เร็คคอร์ด ต่อหน้า",
"sZeroRecords": "ไม่เจอข้อมูลที่ค้นหา",
"sInfo": "แสดง _START_ ถึง _END_ ของ _TOTAL_ เร็คคอร์ด",
"sInfoEmpty": "แสดง 0 ถึง 0 ของ 0 เร็คคอร์ด",
"sInfoFiltered": "(จากเร็คคอร์ดทั้งหมด _MAX_ เร็คคอร์ด)",
"sSearch": "ค้นหา :",
"oPaginate": {
"sFirst": "เริ่มต้น",
"sPrevious": "ก่อนหน้า",
"sNext": "ถัดไป",
"sLast": "สุดท้าย"
}
},
"iDisplayLength" : 10,
"aLengthMenu" : [[10, 15, 25, 50, 100, -1], [10, 15, 25, 50, 100, "ทั้งหมด"]],
"sPaginationType" : "simple_numbers",
});
} );
</script>
<script type="text/javascript">
$(document).ready(function() {
$('#DocumentLoad').DataTable( {
"processing": true,
"serverSide": true,
"ajax": "server_processing.php",
"footerCallback": function ( row, data, start, end, display ) {
var api = this.api(), data;
// Remove the formatting to get integer data for summation
var intVal = function ( i ) {
return typeof i === 'string' ?
i.replace(/[\$,]/g, '')*1 :
typeof i === 'number' ?
i : 0;
};
// Total over all pages
total = api
.column( 5 )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
// Total over this page
pageTotal = api
.column( 5, { page: 'current'} )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
// Update footer
$( api.column( 5 ).footer() ).html(
'$'+pageTotal +' total'
);
}
} );
} );
</script>
</div>
</div>