| Server IP : 104.21.80.248 / Your IP : 172.71.28.156 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Inetpub/www/news/edu2018/print/ |
Upload File : |
<?php
date_default_timezone_set("Asia/Bangkok");
require_once("setPDF.php"); // ไฟล์สำหรับกำหนดรายละเอียด pdf
require_once('../config.php');
// เพิ่มหน้าใน PDF
$pdf->SetTitle('ข้อมูลนักเรียนกลับบ้าน'); //Titlo del pdf
$pdf->setPrintHeader(true); //หัวกระดาษ
$pdf->setPrintFooter(true); //No se imprime pie de pagina
$pdf->SetMargins(7, 25, 7, false); //ตั้งค่าระยะห่างจากหัวกระดาษ
$pdf->SetAutoPageBreak(true, 20); //Se define un salto de pagina con un limite de pie de pagina
$pdf->AddPage();
$pdf->Ln(-5);
$date=date("d/m/Y H:i:s");
$tbl1 = <<<EOD
<table border="0">
<tr>
<td style="width:180px;" align="center"></td>
<td style="width:180px;" align="center">ข้อมูลนักเรียนกลับบ้าน</td>
<td style="width:180px;" align="right">วันที่ $date</td>
</tr>
</table>
EOD;
$pdf->writeHTML($tbl1, true, 0, true, 0);
$pdf->Ln(-5);
$html = '<table width="100%" style="border:1px solid;">
<thead>
<tr>
<th style=" width:25px;" align="center"><b>ที่</b></th>
<th style=" width:80px;" align="center"><b>รหัส</b></th>
<th style=" width:130px;" align="center"><b>ชื่อ-นามสกุล</b></th>
<th style=" width:32px;" align="center"><b>ชั้น</b></th>
<th style=" width:70px;" align="center"><b>ชื่อหอพัก</b></th>
<th style=" width:110px;" align="center"><b>ผู้มารับ</b></th>
<th style=" width:100px;" align="center"><b>วันที่</b></th>
</tr></thead><tbody>';
$SQL1 = $mysqli->query("SELECT * FROM student where status='out' AND active='yes' ORDER BY class ASC");
$i = 0;
while($Row=mysqli_fetch_array($SQL1)) {
$code=$Row["code"];
$prefix=$Row["prefix"];
$name=$Row["name"];
$sname=$Row["sname"];
$full="$prefix$name $sname";
$class=$Row["class"];
$ad=$Row["ad"];
$moo=$Row["moo"];
$tambol=$Row["tambol"];
$ampher=$Row["ampher"];
$province=$Row["province"];
$zipcode=$Row["zipcode"];
$rsroom=$Row["rsroom"];
$sql27= $mysqli->query("SELECT * FROM checkout where stucode='$code' ORDER BY Id DESC");
$Row27 = mysqli_fetch_array($sql27);
$day=$Row27["date"];
$tid=$Row27["tid"];
$sql28= $mysqli->query("SELECT * FROM grand where stucode='$code' AND tid='$tid'");
$Row28 = mysqli_fetch_array($sql28);
$tprefix=$Row28["tprefix"];
$tname=$Row28["tname"];
$tsname=$Row28["tsname"];
$i++;
$html .= '<tr>
<td style="width:25px;" align="center">'.$i.'</td>
<td style="width:80px;" align="center">'.$code.'</td>
<td style="width:130px;"> '.$full.'</td>
<td style=" width:32px;" align="center"> '.$class.'</td>
<td style=" width:70px;" align="center">'.$rsroom.'</td>
<td style=" width:110px;" align="left"> '.$tprefix.''.$tname.' '.$tsname.'</td>
<td style=" width:100px;" align="center">'.$day.'</td>
</tr>';
}
$html .= '</tbody></table>';
// เลื่อน pointer ไปหน้าสุดท้าย
$pdf->writeHTML($html, true, 0, true, 0);
$pdf->lastPage();
// ปิดและสร้างเอกสาร PDF
ob_end_clean();
$today = date("dmY");
$pdf->Output('Live-Report'.$today.'.pdf', 'I');
?>