Server IP : 150.95.80.236 / Your IP : 13.59.248.75 Web Server : Apache System : Linux host-150-95-80-236 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : social-telecare ( 10000) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/pcu.in.th/sc.pcu.in.th/export_pdf/ |
Upload File : |
<?php // require('fpdf.php'); require('mc_table.php'); include("../connect.php"); include("../function.php"); header('X-Robots-Tag: noindex, nofollow'); session_start(); if (isset($_SESSION['sess_id']) <> session_id()) { echo "<script>window.location.replace('../signin.php');</script>"; } class PDF extends PDF_MC_Table { function Header() { include("../connect.php"); $query_form = $conn->query("SELECT sm.*, CONCAT(cd.case_tname,cd.case_name) AS full_name, cd.case_hn, cd.case_bday FROM form_pps sm LEFT JOIN case_data cd ON cd.user_id = sm.case_id WHERE sm.pps_id = '" . $_REQUEST['pps_id'] . "' "); $fet_data = $query_form->fetch_assoc(); $fet_data['count'] = $conn->query("SELECT COUNT(pps_id) AS count FROM form_pps WHERE case_id = '".$fet_data['case_id']."' AND pps_id <= '".$_REQUEST['pps_id']."' ")->fetch_object()->count; $fet_data['form_date'] = thaidate($fet_data['pps_date']); $this->AddFont('THSarabunPSK', '', 'THSarabun.php'); $this->AddFont('THSarabunPSK', 'b', 'THSarabun Bold.php'); //หนา $this->SetFont('THSarabunPSK', 'b', 18); $this->Image('../assets/logo/SOCIAL TELECARE (Logo 2).png', 10, 0, 25, 0); $this->Cell(0, 10, iconv('UTF-8', 'cp874', 'แบบประเมินระดับผู้ป่วยที่ได้รับการดูแลแบบประคับประคอง ฉบับสวนดอก'), 0, true, 'C'); $this->SetFont('THSarabunPSK', 'b', 16); $this->Cell(27, 6, iconv('UTF-8', 'cp874', 'ครั้งที่ประเมิน ')); $this->SetFont('THSarabunPSK', '', 16); $this->Cell(10, 6, iconv('UTF-8', 'cp874', $fet_data['count']), 0, false, 'L'); $this->SetFont('THSarabunPSK', 'b', 16); $this->Cell(20, 6, iconv('UTF-8', 'cp874', 'ชื่อ-สกุล')); $this->SetFont('THSarabunPSK', '', 16); $this->Cell(70, 6, iconv('UTF-8', 'cp874', $fet_data['full_name']), 0, false, 'L'); $this->SetFont('THSarabunPSK', 'b', 16); $this->Cell(25, 6, iconv('UTF-8', 'cp874', 'วันที่ประเมิน')); $this->SetFont('THSarabunPSK', '', 16); $this->Cell(28, 6, iconv('UTF-8', 'cp874', $fet_data['form_date']), 0, false, 'L'); $this->Ln(); $this->SetFont('THSarabunPSK', 'b', 16); $this->Cell(15, 10, iconv('UTF-8', 'cp874', 'ลำดับ '), 1, false, 'C'); $this->Cell(140, 10, iconv('UTF-8', 'cp874', 'คำถาม/รายละเอียด '), 1, false, 'C'); $this->Cell(125, 10, iconv('UTF-8', 'cp874', 'คำตอบ'), 1, false, 'C'); // $this->Cell(45, 10 , iconv( 'UTF-8','cp874' , 'หมายเหตุ ' ),1 ,false, 'C' ); // $this->Cell(27, 20 , iconv( 'UTF-8','cp874' , 'ลำดับ ' ),1 ,false, 'C' ); $this->Ln(); // 15,220,45 } function Footer() { // Position at 1.5 cm from bottom $this->SetY(-15); // Arial italic 8 $this->SetFont('Arial', 'I', 8); // Page number $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C'); } } $pdf = new PDF('L', 'mm', 'A4'); $pdf->AddPage(); $pdf->AliasNbPages(); $pdf->SetTitle("( Palliative Performance Scale for adultSuandok) (PPS AdultSuandok )"); $pdf->AddFont('THSarabunPSK', '', 'THSarabun.php'); $pdf->AddFont('THSarabunPSK', 'b', 'THSarabun Bold.php'); //หนา $query_main = $conn->query("SELECT form_pps.*, user_data.fname, user_data.lname FROM form_pps LEFT JOIN user_data ON user_data.user_id = form_pps.doctor_id WHERE form_pps.pps_id = '" . $_REQUEST['pps_id'] . "' "); $fet_main = $query_main->fetch_assoc(); $user_id = $fet_main['doctor_id']; $case_id = $fet_main['case_id']; $device = $_SERVER['HTTP_USER_AGENT']; $ip = $_SERVER['REMOTE_ADDR']; $log = $conn->query("INSERT INTO log (log_device,log_ip,case_id,lt_id,user_id,log_created) VALUE ('" . $device . "','" . $ip . "','" . $case_id . "',1,'" . $user_id . "',NOW())"); if ($log) { try { $max_log_id = $conn->query("SELECT MAX(log_id) AS max_id FROM log ")->fetch_object()->max_id; $log_pdf = $conn->query("INSERT INTO log_export_pdf (log_id,formd_id,lep_created) VALUE ('" . $max_log_id . "',13,NOW())"); if (!$log_pdf) { throw new Exception($conn->error); } } catch (\Exception $error) { // error handing } } $query_form = $conn->query("SELECT * FROM main_form WHERE form_id = '26' "); $i = 1; $re_point = array('2q_point', '9q_point', '8q_point'); $result = array('2q_pointname', '9q_pointname', '8q_pointname'); $option = array('2q_pointid', '9q_pointid', '8q_pointid'); $a = 1; $query_ark = $conn->query("SELECT main_ans.* , main_formans.ans_name, main_formark.ark_name FROM main_ans LEFT JOIN main_formans ON main_formans.ans_id = main_ans.ans_id LEFT JOIN main_formark ON main_formark.ark_id = main_formans.ark_id WHERE main_ans.form_ansid = '" . $fet_main['pps_id'] . "' AND main_ans.form_id = '26' AND main_ans.form_type = 'pps' "); while ($fet_ark = $query_ark->fetch_object()) { $pdf->SetWidths(array(15, 140, 125)); $pdf->SetAligns(array('C', 'L')); $pdf->Row(array($a, $fet_ark->ark_name, $fet_ark->ans_name, '')); $a++; } $pdf->SetWidths(array(40, 240)); $pdf->SetAligns(array('L', 'L')); $pdf->RowBold(array("คะแนนรวม", $fet_main['pps_point'])); $pdf->RowBold(array("ระดับ PPS ร้อยละ", $fet_main['pps_pointname'])); $pdf->SetFont('THSarabunPSK', 'B', 14); $pdf->Cell(0, 10, iconv('UTF-8', 'cp874', 'ลงชื่อ'), 0, false, 'C'); $pdf->Ln(); $pdf->Cell(0, 15, iconv('UTF-8', 'cp874', '..............................................'), 0, false, 'C'); $pdf->Ln(); $pdf->Cell(150, 0, iconv('UTF-8', 'cp874', 'ผู้ประเมินแทน นักสังคมสงเคราะห์'), 0, false, 'R'); $pdf->SetFont('THSarabunPSK', '', 14); // $pdf->Cell(100, 0, iconv( 'UTF-8','cp874' , ),0 ,false, 'L' ); $group_name = $conn->query("SELECT ur.group_name FROM user_data ud LEFT JOIN user_role ur ON ur.group_id = ud.user_gid WHERE ud.user_id = '".$fet_main['doctor_id']."' ")->fetch_object()->group_name; $pdf->Cell(150, 0, iconv('UTF-8', 'cp874', $fet_main['fname'] . " " . $fet_main['lname']."\t(".$group_name.")"), 0, false, 'L'); $pdf->Output();