Mini Shell
<?php
include '../db/database.php';
include '../mpdf/mpdf.php';
ob_start();
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="text-center">
<img src="dist/img/logoccp.gif" width="92px">
</div>
<?php
$year = $_GET['itemname'];
if(empty($year)){
}else{
$sql = "SELECT * FROM teacher
INNER JOIN title_name AS t1 ON t1.titleID = teacher.titleID AND teacher.titleID = t1.titleID
INNER JOIN la_history AS t2 ON t2.teacherlaID = teacher.teacherID
where (status_user = 1 or status_user = 2 or status_user = 3) and t2.year = $year ";
$query = mysqli_query($link,$sql);
$row = mysqli_num_rows($query);
?>
<h3 class="text-center"><strong>โรงเรียนเทศบาลวัดชัยชุมพล เทศบาลเมืองทุ่งสง<strong></h3><strong>
<h4 class="text-center"><strong>รายงานข้อมูลการลาของบุคลากร ประจำปีการศึกษา <?php echo $year; ?><strong></h4><strong>
<h4 class="text-center"><strong>ทั้งหมด <?php echo $row ?> คน<strong></h4><strong>
<section class="content">
<div class="col-md-8 col-md-offset-2">
<div class="table-responsive">
<table align="center"id="mytable" class="table table-bordered">
<thead >
<tr class="active">
<th class="text-center">ลำดับ</th>
<th>ชื่อ-นามสกุล</th>
<th style="text-align: center;">ลาป่วย(วัน)</th>
<th style="text-align: center;">ลากิจ(วัน)</th>
<th style="text-align: center;">ลาคลอด(วัน)</th>
<th style="text-align: center;">รวม(วัน)</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
if(!empty($row)){
while ($result = mysqli_fetch_assoc($query)) { ?>
<tr>
<td class="text-center"><?php echo $i;?></td>
<td><?php echo $result['titleName']. $result['name'];?> <?php echo $result['lastName'];?></td>
<td style="text-align: center;"><?php echo $result['lasick'];?></td>
<td style="text-align: center;"><?php echo $result['laerrand'];?></td>
<td style="text-align: center;"><?php echo $result['lamaternity'];?></td>
<?php
$lasum = $result['lasick']+$result['laerrand']+$result['lamaternity'];
?>
<td style="text-align: center;"><?php echo $lasum;?></td>
</tr>
<?php $i++; } ?>
<?php
}else if(empty($row)){
?>
<tr>
<th colspan="6" align="center"><i class="fa fa-folder-open"></i> ไม่พบข้อมูล</th>
</tr>
<?php } ?>
</tbody>
</table>
</div><!-- /.box-body -->
<div class="box-footer">
</div><!-- box-footer -->
</div><!-- /.box -->
<?php
}
?>
</section><!-- /.content -->
<?php
include 'function_datethai.php';
date_default_timezone_set("Asia/Bangkok");
$eng_date=time();
?>
<?php
$html = ob_get_contents();
ob_end_clean();
$mpdf=new mPDF('utf-8');
$mpdf->margin_header = 9;
$mpdf->SetHeader('รายงานโดย โรงเรียนเทศบาลวัดชัยชุมพล | รายงานข้อมูลการลาของบุคลากร | ออกรายงานเมื่อ: '.thai_date($eng_date));
$mpdf->margin_footer = 9;
$mpdf->SetFooter('หน้าที่ {PAGENO}');
// Define a Landscape page size/format by name
//$mpdf=new mPDF('utf-8', 'A4-L');
// Define a page size/format by array - page will be 190mm wide x 236mm height
//$mpdf=new mPDF('utf-8', array(190,236));
$stylesheet = file_get_contents('./bootstrap/css/printpdf.css');
//$mpdf->SetDisplayMode('fullpage');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($html,2);
//$mpdf->Output();
$mpdf->Output(time().'.pdf','D');
exit;
?>
</body>
</html>
Zerion Mini Shell 1.0