Viewing file: v_rptRis112_11.php (6 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
define('FPDF_FONTPATH',$this->config->item('path_application').'/font/');
//$this->load->library('fpdf_thai');
class PDF extends FPDF {
var $cfgClgLogo;
var $cfgClgName;
var $cfgSiteName;
//Page header
function Header() {
//Logo
$this->Image($this->cfgClgLogo,10,3,18,15);
//AngsanaNew bold 15
$this->SetFont('AngsanaNew','B',15);
//Move to the right
$this->SetY(7);
$this->SetX(30);
//Title
$this->Cell(0,0,$this->cfgClgName,0,0,'L');
$this->SetX(-10);
$this->SetFontSize(12);
$this->Cell(0,0,'RIS999',0,0,'R');
$this->Ln(7);
$this->SetX(30);
$this->SetFontSize(15);
$this->Cell(0,0,$this->cfgSiteName,0,0,'L');
//Draw line
$this->SetLineWidth(0.4);
$this->Line(10,19,200,19);
}
//Page footer
function Footer() {
//Position at 3.0 cm from bottom
$this->SetLineWidth(0.4);
$this->Line(10,286,200,286);
$this->SetY(-7);
$this->SetFont('AngsanaNew','',14);
//Page number
$this->Cell(0,0,'หน้า '.$this->PageNo().'/{nb}',0,0,'R');
$this->SetY(-7);
$this->Cell(0,0,'วันที่พิมพ์ : '.date("d/m/y H:i"),0,0,'L');
}
} //End class
//Create new pdf file
$pdf=new PDF();
$pdf->cfgClgLogo = $this->config->item('rg_upload_picture').$cfgClgLogo;
$pdf->cfgClgName = iconv('UTF-8','TIS-620',$cfgClgName);
$pdf->cfgSiteName = iconv('UTF-8','TIS-620',$cfgSiteName);
//Set thai font
$pdf->SetThaiFont();
$pdf->AliasNbPages();
//Open file
$pdf->Open();
//Disable automatic page break
$pdf->SetAutoPageBreak(false);
//Set initial y axis position per page
$y_axis_initial = 50;
//Set initial x position of table
$x_axis_initial = 20;
//Set Row Height
$row_height = 6;
if ( $rs_std->num_rows() > 0) {
foreach($rs_std->result() as $row) {
$pdf->AddPage();
$pdf->SetFont('AngsanaNew','B',18);
$pdf->SetX(105);
$pdf->SetY(24);
$pdf->Cell(0,0,'รายงานผลการเรียนนักศึกษาแจ้งผู้ปกครอง',0,0,'C');
$pdf->Ln(7);
$pdf->SetFontSize(16);
$pdf->Cell(0,0,'หลักสูตร '.iconv('UTF-8','CP874',$row->curName).' ระดับ '.iconv('UTF-8','CP874',$row->levelName).' รุ่นที่ '.iconv('UTF-8','CP874',$row->genNo),0,0,'C');
$pdf->Ln(7);
$pdf->Cell(0,0,'ภาคการศึกษาที่ '.$tmId.' ปีการศึกษา '.$acY,0,0,'C');
$pdf->Ln(7);
$pdf->Cell(0,0,'รหัสนักศึกษา '.iconv('UTF-8','CP874',$row->stdCode).' ชื่อ-สกุลนักศึกษา '.iconv('UTF-8','CP874',$row->prefixName).iconv('UTF-8','CP874',$row->stdName).' '.iconv('UTF-8','CP874',$row->stdSurname),0,0,'C');
//print column titles for the actual page
$pdf->SetFillColor(232,232,232);
$pdf->SetFontSize(14);
$pdf->SetY($y_axis_initial);
$pdf->SetX($x_axis_initial);
$pdf->Cell(25,6,'รหัสวิชา',1,0,'C',1);
$pdf->Cell(95,6,'รายวิชา',1,0,'C',1);
$pdf->Cell(25,6,'หน่วยกิต',1,0,'C',1);
$pdf->Cell(25,6,'ระดับคะแนน',1,0,'C',1);
$y_axis = $y_axis_initial + $row_height;
$rs_rd = $rd->getRegistDetailsByStdIdAcYTmId($row->stdId, $acY, $tmId);
if ( $rs_rd->num_rows() > 0) {
foreach($rs_rd->result() as $row_rd) {
$pdf->SetFont('AngsanaNew','',14);
$pdf->SetY($y_axis);
$pdf->SetX($x_axis_initial);
$pdf->Cell(25,6,iconv('UTF-8','CP874',$row_rd->crsCode),1,0,'C');
$pdf->Cell(95,6,iconv('UTF-8','CP874',$row_rd->crsName),1,0,'L');
$pdf->Cell(25,6,iconv('UTF-8','CP874',$row_rd->crsUnit),1,0,'C');
if ($row_rd->coDeclareStatus == 'Y') {
$pdf->Cell(25,6,iconv('UTF-8','CP874',$row_rd->rdGrade),1,0,'C');
} else {
$pdf->Cell(25,6,'',1,0,'C');
}
//Go to next row
$y_axis = $y_axis + $row_height;
}
}
$y_axis = $y_axis + $row_height;
$pdf->SetY($y_axis);
$pdf->SetX($x_axis_initial);
$pdf->Cell(0,0,'หมายเหตุ',0,0,'L');
$y_axis = $y_axis + $row_height;
$i = 0;
$rs_grd = $grd->qryGtpId($row->curGtpId);
foreach($rs_grd->result() as $row_grd) {
if(($i%5) == 0) {
$pdf->SetY($y_axis);
$pdf->SetX($x_axis_initial);
$y_axis = $y_axis + $row_height;
}
$pdf->Cell(35,0,iconv('UTF-8','CP874',$row_grd->grdGrade).' : '.iconv('UTF-8','CP874',$row_grd->grdDescription),0,0,'L');
$i++;
}
$cond = array('ssmStdId' => $row->stdId,
'ssmAcY' => $acY,
'ssmTmId' => $tmId);
$qu_ssm = $ssm->qrySsm($cond);
if ($qu_ssm->num_rows()) {
$row_ssm = $qu_ssm->row();
$gpa = iconv('UTF-8','CP874',$row_ssm->ssmGPA);
$ssmCreditPoint = iconv('UTF-8','CP874',$row_ssm->ssmCreditPoint);
$ssmGPAX = iconv('UTF-8','CP874',$row_ssm->ssmGPAX);
$ssmSumCreditPoint = iconv('UTF-8','CP874',$row_ssm->ssmSumCreditPoint);
} else {
$gpa = 0;
$ssmCreditPoint = '';
$ssmGPAX = 0;
$ssmSumCreditPoint = '';
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis_initial);
$pdf->Cell(90,0,'คะแนนเฉลี่ยรายภาค : '.number_format($gpa, 2),0,0,'L');
$pdf->Cell(0,0,'รวมหน่วยกิตรายภาค : '.$ssmCreditPoint,0,0,'L');
$pdf->Ln(7);
$pdf->SetX($x_axis_initial);
$pdf->Cell(90,0,'คะแนนเฉลี่ยสะสม : '.number_format($ssmGPAX, 2),0,0,'L');
$pdf->Cell(0,0,'รวมหน่วยกิต : '.$ssmSumCreditPoint,0,0,'L');
$pdf->SetY(230);
$pdf->SetX(70);
$pdf->Cell(0,0,'เรียน',0,0,'L');
$pdf->Ln(7);
$pdf->SetX(80);
$pdf->Cell(0,0,'ผู้ปกครอง '.iconv('UTF-8','CP874',$row->prefixName).iconv('UTF-8','CP874',$row->stdName).' '.iconv('UTF-8','CP874',$row->stdSurname),0,0,'L');
$pdf->Ln(7);
$pdf->SetX(80);
$pdf->Cell(0,0,'ที่อยู ่ '.iconv('UTF-8','CP874',$row->sdtParentAddr),0,0,'L');
$pdf->Ln(7);
$pdf->SetX(80);
$pdf->Cell(0,0,'ตำบล '.iconv('UTF-8','CP874',$row->districtName).' อำเภอ '.iconv('UTF-8','CP874',$row->amphurName),0,0,'L');
$pdf->Ln(7);
$pdf->SetX(80);
$pdf->Cell(0,0,'จังหวัด '.iconv('UTF-8','CP874',$row->provinceName).' '.iconv('UTF-8','CP874',$row->sdtParentPostCode),0,0,'L');
} //End foreach
} else {
$pdf->SetFontSize(18);
$pdf->Cell(105);
$pdf->SetY(27);
$pdf->Cell(0,0,'ไม่มีข้อมูล...',0,0,'C');
}
//Create file
$pdf->Output();
?>
|