| 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/datacenter/admin/report/ |
Upload File : |
<?php
require_once("setPDF.php"); // ไฟล์สำหรับกำหนดรายละเอียด pdf
require_once('../config.php');
// เพิ่มหน้าใน PDF
/*
$code = $mysqli->escape_string($_GET['stucode']);
$SQLy = $mysqli->query("SELECT * FROM history WHERE stucode ='$code'");
$Rowy = mysqli_fetch_array($SQLy);
$stu=$Rowy['stucode'];
*/
$pdf->SetTitle('รายงาน PDF'); //Titlo del pdf
$pdf->setPrintHeader(false); //หัวกระดาษ
$pdf->setPrintFooter(true); //No se imprime pie de pagina
$pdf->SetMargins(15, 16, 15, false); //ตั้งค่าระยะห่างจากหัวกระดาษ
$pdf->SetAutoPageBreak(true, 20); //Se define un salto de pagina con un limite de pie de pagina
$pdf->AddPage();
// กำหนด HTML code หรือรับค่าจากตัวแปรที่ส่งมา
// กรณีกำหนดโดยตรง
// ตัวอย่าง กรณีรับจากตัวแปร
// $htmlcontent =$_POST['HTMLcode'];
//$htmlcontent='<p>ทดสอบการแปลงไฟล์</p>';
$htmlcontent=stripslashes($htmlcontent);
$htmlcontent=AdjustHTML($htmlcontent);
// สร้างเนื้อหาจาก HTML code
$tbl1 = <<<EOD
ข้อมูลการสมัครเรียน
EOD;
$user1 = <<<EOD
รายชื่อผู้สมัครเรียน
EOD;
$html = '<table width="600" 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:110px;" align="center"><b>ชื่อ-สกุล</b></th>
<th style=" width:30px;" align="center"><b>ชั้น</b></th>
<th style=" width:255px;" align="center"><b>ที่อยู่</b></th>
</tr></thead><tbody>';
$sql2 = "SELECT * FROM `read_data` INNER JOIN `student_regis` ON `student_regis`.`r_idcard` = `read_data`.`cid` where status='stu'
ORDER BY r_class DESC;";
$dbquery2 = $mysqli->query($sql2);
$i = 0;
while($row2=mysqli_fetch_array($dbquery2)) {
$cid=$row2['cid'];
$thnamep=$row2['thnamep'];
$thnamef=$row2['thnamef'];
$thnamel=$row2['thnamel'];
$r_class=$row2['r_class'];
$addressn=$row2['addressn'];
$addressm=$row2['addressm'];
$addresst=$row2['addresst'];
$addressa=$row2['addressa'];
$addressp=$row2['addressp'];
$i++;
$html .= '<tr>';
$html .= '<td style="width:25px;" align="center">'.$i.'</td>';
$html .= '<td style="width:80px;" align="center">'.$cid.'</td>';
$html .= '<td style="width:110px;" align="left"> '.$thnamep.''.$thnamef.' '.$thnamel.'</td>';
$html .= '<td style="width:30px;" align="center">'.$r_class.'</td>';
$html .= '<td style="width:255px;" align="left"> '.$addressn.''.$addressm.' '.$addresst.' '.$addressa.' '.$addressp.'</td>';
$html .= '</tr>';
}
$html .= '</tbody></table>';
// เลื่อน pointer ไปหน้าสุดท้าย
$pdf->Ln(-3);
$pdf->SetFont('th-sarabun','b',24);
$pdf->Cell(0, 0, $tbl1, 0, 0, 'C');
$pdf->Ln(10);
$pdf->SetFont('th-sarabun','b',16);
$pdf->Cell(0, 0, $user1, 0, 0, 'C');
$pdf->Ln(10);
$pdf->SetFont('','',15,'','','L');
$pdf->writeHTML($html, true, 0, true, 0);
$pdf->lastPage();
// ปิดและสร้างเอกสาร PDF
ob_end_clean();
$today = date("dmY");
$pdf->Output('goosd-Report'.$today.'.pdf', 'I');
?>