Viewing file: v_rptRis113.php (23.75 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php ini_set("memory_limit", $this->config->item('rg_memory_limit'));
define('FPDF_FONTPATH',$this->config->item('path_application').'/font/'); //$this->load->library('fpdf_thai');
class PDF extends FPDF { var $cfgClgLogo; var $cfgClgName; var $cfgSiteName; var $lSignature; var $mSignature; var $rSignature; var $lPos; var $mPos; var $rPos; var $qu_lSignature; var $qu_mSignature; var $qu_rSignature;
//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,'RIS113',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() { $y_axis = 272; $this->SetY($y_axis); $this->SetX(15); $this->SetFont('AngsanaNew','',12); $this->Cell(60,0,($this->lSignature && $this->lPos) ? '..................................................' : '',0,0,'C'); $this->Cell(60,0,($this->mSignature && $this->mPos) ? '..................................................' : '',0,0,'C'); $this->Cell(60,0,($this->rSignature && $this->rPos) ? '..................................................' : '',0,0,'C'); $y_axis = $y_axis + 5; $this->SetY($y_axis); $this->SetX(15); $this->Cell(60,0,($this->lSignature && $this->lPos) ? '('.iconv('UTF-8','CP874',$this->qu_lSignature).')' : '',0,0,'C'); $this->Cell(60,0,($this->mSignature && $this->mPos) ? '('.iconv('UTF-8','CP874',$this->qu_mSignature).')' : '',0,0,'C'); $this->Cell(60,0,($this->rSignature && $this->rPos) ? '('.iconv('UTF-8','CP874',$this->qu_rSignature).')' : '',0,0,'C'); $y_axis = $y_axis + 5; $tmpLPos = explode('^', $this->lPos); $tmpMPos = explode('^', $this->mPos); $tmpRPos = explode('^', $this->rPos); $this->SetY($y_axis); $this->SetX(15);
if($this->lang=='T2') { $this->Cell(60,0,($this->lSignature && $this->lPos) ? iconv('UTF-8','CP874',a2th($tmpLPos[0])) : '',0,0,'C'); $this->Cell(60,0,($this->mSignature && $this->mPos) ? iconv('UTF-8','CP874',a2th($tmpMPos[0])) : '',0,0,'C'); $this->Cell(60,0,($this->rSignature && $this->rPos) ? iconv('UTF-8','CP874',a2th($tmpRPos[0])) : '',0,0,'C'); } else { $this->Cell(60,0,($this->lSignature && $this->lPos) ? iconv('UTF-8','CP874',th2a($tmpLPos[0])) : '',0,0,'C'); $this->Cell(60,0,($this->mSignature && $this->mPos) ? iconv('UTF-8','CP874',th2a($tmpMPos[0])) : '',0,0,'C'); $this->Cell(60,0,($this->rSignature && $this->rPos) ? iconv('UTF-8','CP874',th2a($tmpRPos[0])) : '',0,0,'C'); } $y_axis = $y_axis + 5; $this->SetY($y_axis); $this->SetX(15);
if($this->lang=='T2') { $this->Cell(60,0,($this->lSignature && $this->lPos && isset($tmpLPos[1])) ? iconv('UTF-8','CP874',a2th($tmpLPos[1])) : '',0,0,'C'); $this->Cell(60,0,($this->mSignature && $this->mPos && isset($tmpMPos[1])) ? iconv('UTF-8','CP874',a2th($tmpMPos[1])) : '',0,0,'C'); $this->Cell(60,0,($this->rSignature && $this->rPos && isset($tmpRPos[1])) ? iconv('UTF-8','CP874',a2th($tmpRPos[1])) : '',0,0,'C'); } else { $this->Cell(60,0,($this->lSignature && $this->lPos && isset($tmpLPos[1])) ? iconv('UTF-8','CP874',th2a($tmpLPos[1])) : '',0,0,'C'); $this->Cell(60,0,($this->mSignature && $this->mPos && isset($tmpMPos[1])) ? iconv('UTF-8','CP874',th2a($tmpMPos[1])) : '',0,0,'C'); $this->Cell(60,0,($this->rSignature && $this->rPos && isset($tmpRPos[1])) ? iconv('UTF-8','CP874',th2a($tmpRPos[1])) : '',0,0,'C'); } //Position at 3.0 cm from bottom $this->SetLineWidth(0.4); $this->Line(10,290,200,290); //Arial italic 8 $this->SetY(-3); //Page number $this->Cell(0,0,'หน้า '.$this->PageNo().'/{nb}',0,0,'R'); $this->SetY(-3); //$this->Cell(10); $this->Cell(0,0,'วันที่พิมพ์ : '.date("d/m/y H:i"),0,0,'L'); } } //End class
//Create new pdf file $pdf=new PDF(); $pdf->lSignature = $lSignature; $pdf->lPos = $lPos; $pdf->mSignature = $mSignature; $pdf->mPos = $mPos; $pdf->rSignature = $rSignature; $pdf->rPos = $rPos; $pdf->qu_lSignature = $qu_lSignature; $pdf->qu_mSignature = $qu_mSignature; $pdf->qu_rSignature = $qu_rSignature; $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); $pdf->lang = $typeLang;
//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 = 45;
//Set initial x position of table $x_axis_initial = 20;
//Set Row Height $row_height = 5;
if ($rs_std->num_rows() > 0) { foreach($rs_std->result() as $row) { $pdf->AddPage(); $pdf->SetFont('AngsanaNew','B',15); $pdf->SetX(105); $pdf->SetY(22);
// ****************************** Thai ****************************** if($typeLang == 'T1' || $typeLang == 'T2') { if($tmId) $pdf->Cell(0,0,'รายงานผลการเรียนนักศึกษารายภาคการศึกษา',0,0,'C'); else $pdf->Cell(0,0,'รายงานผลการเรียนนักศึกษารายปีการศึกษา',0,0,'C'); $pdf->Ln(5); $pdf->SetFontSize(13);
if($typeLang=='T2') { $pdf->Cell(0,0,'หลักสูตร '.iconv('UTF-8','CP874',a2th(explodeSquare($row->curName))).' ระดับ '.iconv('UTF-8','CP874',a2th($row->levelName)).' ชั้นปี '.iconv('UTF-8','CP874',a2th($row->ssmSyId)).' รุ่นที่ '.iconv('UTF-8','CP874',a2th($row->genNo)),0,0,'C'); } else { $pdf->Cell(0,0,'หลักสูตร '.iconv('UTF-8','CP874',th2a(explodeSquare($row->curName))).' ระดับ '.iconv('UTF-8','CP874',th2a($row->levelName)).' ชั้นปี '.iconv('UTF-8','CP874',th2a($row->ssmSyId)).' รุ่นที่ '.iconv('UTF-8','CP874',th2a($row->genNo)),0,0,'C'); }
$pdf->Ln(5); if($tmId) { $tm->tmId = $tmId; $tm->get_by_key(TRUE); if($typeLang=='T2') { $pdf->Cell(0,0,'ภาคการศึกษาที่ '.iconv('UTF-8','CP874',a2th($tm->tmCode)).' ปีการศึกษา '.iconv('UTF-8','CP874',a2th($acY)),0,0,'C'); } else { $pdf->Cell(0,0,'ภาคการศึกษาที่ '.iconv('UTF-8','CP874',th2a($tm->tmCode)).' ปีการศึกษา '.iconv('UTF-8','CP874',th2a($acY)),0,0,'C'); } } else { if($typeLang=='T2') { $pdf->Cell(0,0,'ปีการศึกษา '.iconv('UTF-8','CP874',a2th($acY)),0,0,'C'); } else { $pdf->Cell(0,0,'ปีการศึกษา '.iconv('UTF-8','CP874',th2a($acY)),0,0,'C'); } } $pdf->Ln(5);
if($typeLang=='T2') { $pdf->Cell(0,0,'รหัสนักศึกษา '.iconv('UTF-8','CP874',a2th($row->stdCode)).' ชื่อ-สกุลนักศึกษา '.iconv('UTF-8','CP874',$row->prefixName).iconv('UTF-8','CP874',$row->stdName).' '.iconv('UTF-8','CP874',$row->stdSurname),0,0,'C'); } else { $pdf->Cell(0,0,'รหัสนักศึกษา '.iconv('UTF-8','CP874',th2a($row->stdCode)).' ชื่อ-สกุลนักศึกษา '.iconv('UTF-8','CP874',$row->prefixName).iconv('UTF-8','CP874',$row->stdName).' '.iconv('UTF-8','CP874',$row->stdSurname),0,0,'C'); }
$pdf->Ln(5); $pdf->Cell(0,0,'เจ้าของทุน '.iconv('UTF-8','CP874',$row->soName).' จังหวัด '.iconv('UTF-8','CP874',$row->soPrv),0,0,'C');
//print column titles for the actual page $pdf->SetFillColor(232,232,232); $pdf->SetFontSize(12); $pdf->SetY($y_axis_initial); $pdf->SetX($x_axis_initial); $pdf->Cell(20,5,'รหัสวิชา',1,0,'C',1); $pdf->Cell(110,5,'รายวิชา',1,0,'C',1); $pdf->Cell(20,5,'หน่วยกิต',1,0,'C',1); $pdf->Cell(20,5,'ระดับคะแนน',1,0,'C',1); $y_axis = $y_axis_initial + $row_height;
/***************************** ระบุภาคการศึกษา ******************************/ if($tmId!='') { $rs_rd = $rd->getRegistDetailsByStdIdAcYTmId($row->stdId, $acY,$tmId); if ( $rs_rd->num_rows() > 0) { foreach($rs_rd->result() as $row_rd) { $pdf->SetFont('AngsanaNew','',12); $pdf->SetY($y_axis); $pdf->SetX($x_axis_initial);
if($typeLang == 'T2') { $pdf->Cell(20,5,iconv('UTF-8','CP874',a2th($row_rd->crsCode)),1,0,'C'); $pdf->Cell(110,5,iconv('UTF-8','CP874',a2th(explodeSquare($row_rd->crsName))),1,0,'L'); $pdf->Cell(20,5,iconv('UTF-8','CP874',a2th($row_rd->crsUnit)),1,0,'C'); } else { $pdf->Cell(20,5,iconv('UTF-8','CP874',th2a($row_rd->crsCode)),1,0,'C'); $pdf->Cell(110,5,iconv('UTF-8','CP874',th2a(explodeSquare($row_rd->crsName))),1,0,'L'); $pdf->Cell(20,5,iconv('UTF-8','CP874',th2a($row_rd->crsUnit)),1,0,'C'); }
if ($row_rd->coDeclareStatus == 'Y') { $pdf->Cell(20,5,iconv('UTF-8','CP874',$row_rd->rdGrade),1,0,'C'); } else { $pdf->Cell(20,5,'',1,0,'C'); }
//Go to next row $y_axis = $y_axis + $row_height; } } }else { $rs_tm = $tm->qryTm(); if($rs_tm->num_rows() > 0) { foreach($rs_tm->result() as $row_tm) { $k = 0; $rs_rd = $rd->getRegistDetailsByStdIdAcYTmId($row->stdId, $acY,$row_tm->tmId); if ( $rs_rd->num_rows() > 0) { foreach($rs_rd->result() as $row_rd2) { if(!$k) { $pdf->SetFont('AngsanaNew','B',12); $pdf->SetY($y_axis); $pdf->SetX($x_axis_initial); $pdf->Cell(20,5,'',1,0,'C');
if($typeLang == 'T2') { $pdf->Cell(110,5,iconv('UTF-8','CP874',a2th($row_tm->tmName)),1,0,'C'); } else { $pdf->Cell(110,5,iconv('UTF-8','CP874',th2a($row_tm->tmName)),1,0,'C'); }
$pdf->Cell(20,5,'',1,0,'C'); $pdf->Cell(20,5,'',1,0,'C'); $y_axis = $y_axis + $row_height; }
$pdf->SetFont('AngsanaNew','',12); $pdf->SetY($y_axis); $pdf->SetX($x_axis_initial);
if($typeLang == 'T2') { $pdf->Cell(20,5,iconv('UTF-8','CP874',a2th($row_rd2->crsCode)),1,0,'C'); $pdf->Cell(110,5,iconv('UTF-8','CP874',a2th(explodeSquare($row_rd2->crsName))),1,0,'L'); $pdf->Cell(20,5,iconv('UTF-8','CP874',a2th($row_rd2->crsUnit)),1,0,'C'); } else { $pdf->Cell(20,5,iconv('UTF-8','CP874',th2a($row_rd2->crsCode)),1,0,'C'); $pdf->Cell(110,5,iconv('UTF-8','CP874',th2a(explodeSquare($row_rd2->crsName))),1,0,'L'); $pdf->Cell(20,5,iconv('UTF-8','CP874',th2a($row_rd2->crsUnit)),1,0,'C'); }
if ($row_rd2->coDeclareStatus == 'Y') { $pdf->Cell(20,5,iconv('UTF-8','CP874',$row_rd2->rdGrade),1,0,'C'); } else { $pdf->Cell(20,5,'',1,0,'C'); } //Go to next row $y_axis = $y_axis + $row_height;
if($k == $rs_rd->num_rows()-1) { $cond = array('ssmStdId' => $row->stdId, 'ssmAcY' => $acY, 'ssmTmId' => $row_tm->tmId); $qu_ssm2 = $ssm->qrySsm($cond); if ($qu_ssm2->num_rows()) { $row_ssm2 = $qu_ssm2->row(); $gpa = iconv('UTF-8','CP874',$row_ssm2->ssmGPA); $ssmCreditPoint = iconv('UTF-8','CP874',$row_ssm2->ssmCreditPoint); $ssmGPAX = iconv('UTF-8','CP874',$row_ssm2->ssmGPAX); $ssmSumCreditPoint = iconv('UTF-8','CP874',$row_ssm2->ssmSumCreditPoint); } else { $gpa = 0; $ssmCreditPoint = ''; $ssmGPAX = 0; $ssmSumCreditPoint = ''; } $pdf->SetFont('AngsanaNew','B',12); $pdf->SetY($y_axis); $pdf->SetX($x_axis_initial); $pdf->Cell(20,5,'',1,0,'C'); $tmpDivision = $rd->GetAllFDivisorGPAX($row->stdId,$acY,$row_tm->tmId); if($tmpDivision==0) { if($typeLang=='T2') { $pdf->Cell(110,5,'หน่วยกิต: '.iconv('UTF-8','CP874',a2th($ssmCreditPoint)).' คะแนนเฉลี่ย: '.number_format(iconv('UTF-8','CP974',a2th($gpa)), 2).' หน่วยกิตสะสม: '.iconv('UTF-8','CP874',a2th($ssmSumCreditPoint)).' คะแนนเฉลี่ยสะสม: '.a2th(number_format(0, 2)),1,0,'C'); } else { $pdf->Cell(110,5,'หน่วยกิต: '.iconv('UTF-8','CP874',th2a($ssmCreditPoint)).' คะแนนเฉลี่ย: '.number_format(iconv('UTF-8','CP974',th2a($gpa)), 2).' หน่วยกิตสะสม: '.iconv('UTF-8','CP874',th2a($ssmSumCreditPoint)).' คะแนนเฉลี่ยสะสม: '.th2a(number_format(0, 2)),1,0,'C'); } } else { if($typeLang=='T2') { $pdf->Cell(110,5,'หน่วยกิต: '.iconv('UTF-8','CP874',a2th($ssmCreditPoint)).' คะแนนเฉลี่ย: '.iconv('UTF-8','CP874',a2th(number_format($gpa, 2))).' หน่วยกิตสะสม: '.iconv('UTF-8','CP874',a2th($ssmSumCreditPoint)).' คะแนนเฉลี่ยสะสม: '.iconv('UTF-8','CP874',a2th(number_format(($rd->getDividendGPAX($row->stdId,$acY,$row_tm->tmId) / $rd->GetAllFDivisorGPAX($row->stdId,$acY,$row_tm->tmId)), 2))),1,0,'C'); } else { $pdf->Cell(110,5,'หน่วยกิต: '.iconv('UTF-8','CP874',th2a($ssmCreditPoint)).' คะแนนเฉลี่ย: '.iconv('UTF-8','CP874',th2a(number_format($gpa, 2))).' หน่วยกิตสะสม: '.iconv('UTF-8','CP874',th2a($ssmSumCreditPoint)).' คะแนนเฉลี่ยสะสม: '.iconv('UTF-8','CP874',th2a(number_format(($rd->getDividendGPAX($row->stdId,$acY,$row_tm->tmId) / $rd->GetAllFDivisorGPAX($row->stdId,$acY,$row_tm->tmId)), 2))),1,0,'C'); } }
$pdf->Cell(20,5,'',1,0,'C'); $pdf->Cell(20,5,'',1,0,'C'); $y_axis = $y_axis + $row_height; } $k++; } } } //$tmId = $row_tm->tmId; } }
$y_axis = $y_axis + $row_height; $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->SetFont('AngsanaNew','',12); $pdf->SetY($y_axis); $pdf->SetX($x_axis_initial);
if($tmId) { if($typeLang=='T2') { $pdf->Cell(90,0,'คะแนนเฉลี่ยรายภาคการศึกษา : '.iconv('UTF-8','CP874',a2th(number_format($gpa, 2))),0,0,'L'); $pdf->Cell(0,0,'รวมหน่วยกิตรายภาคการศึกษา : '.iconv('UTF-8','CP874',a2th($ssmCreditPoint)),0,0,'L'); } else { $pdf->Cell(90,0,'คะแนนเฉลี่ยรายภาคการศึกษา : '.iconv('UTF-8','CP874',th2a(number_format($gpa, 2))),0,0,'L'); $pdf->Cell(0,0,'รวมหน่วยกิตรายภาคการศึกษา : '.iconv('UTF-8','CP874',th2a($ssmCreditPoint)),0,0,'L'); } } else { $tmpDivision = $rd->GetAllFDivisorAYRGPAX($row->stdId,$acY); if($tmpDivision==0) { if($typeLang=='T2') { $pdf->Cell(90,0,'คะแนนเฉลี่ยตลอดปีการศึกษา : '.iconv('UTF-8','CP874',a2th(number_format(0, 2))),0,0,'L'); } else { $pdf->Cell(90,0,'คะแนนเฉลี่ยตลอดปีการศึกษา : '.iconv('UTF-8','CP874',th2a(number_format(0, 2))),0,0,'L'); } } else { if($typeLang=='T2') { $pdf->Cell(90,0,'คะแนนเฉลี่ยตลอดปีการศึกษา : '.iconv('UTF-8','CP874',a2th(number_format(($rd->GetDividendAYRGPA($row->stdId,$acY) / $rd->GetAllFDivisorAYRGPAX($row->stdId,$acY) ), 2))),0,0,'L'); } else { $pdf->Cell(90,0,'คะแนนเฉลี่ยตลอดปีการศึกษา : '.iconv('UTF-8','CP874',th2a(number_format(($rd->GetDividendAYRGPA($row->stdId,$acY) / $rd->GetAllFDivisorAYRGPAX($row->stdId,$acY) ), 2))),0,0,'L'); } }
if($typeLang=='T2') { $pdf->Cell(0,0,'รวมหน่วยกิตตลอดปีการศึกษา : '.iconv('UTF-8','CP874',a2th($ssm->GetSumCreditPointByStIdAndAcY($row->stdId,$acY))),0,0,'L'); } else { $pdf->Cell(0,0,'รวมหน่วยกิตตลอดปีการศึกษา : '.iconv('UTF-8','CP874',th2a($ssm->GetSumCreditPointByStIdAndAcY($row->stdId,$acY))),0,0,'L'); } } $pdf->Ln(5); $pdf->SetX($x_axis_initial); if($typeLang=='T2') { $pdf->Cell(90,0,'คะแนนเฉลี่ยสะสมตลอดหลักสูตร : '.iconv('UTF-8','CP874',a2th(number_format($row->stdGPA, 2))),0,0,'L'); $pdf->Cell(0,0,'รวมหน่วยกิตสะสมตลอดหลักสูตร : '.iconv('UTF-8','CP874', a2th($ssm->GetSumCreditPointByStId($row->stdId))),0,0,'L'); } else { $pdf->Cell(90,0,'คะแนนเฉลี่ยสะสมตลอดหลักสูตร : '.iconv('UTF-8','CP874',th2a(number_format($row->stdGPA, 2))),0,0,'L'); $pdf->Cell(0,0,'รวมหน่วยกิตสะสมตลอดหลักสูตร : '.iconv('UTF-8','CP874', th2a($ssm->GetSumCreditPointByStId($row->stdId))),0,0,'L'); } }
// ****************************** English ****************************** else if($typeLang == 'E') { if($tmId) $pdf->Cell(0,0,'รายงานผลการเรียนนักศึกษารายภาคการศึกษา',0,0,'C'); else $pdf->Cell(0,0,'รายงานผลการเรียนนักศึกษารายปีการศึกษา',0,0,'C'); $pdf->Ln(5); $pdf->SetFontSize(13); $pdf->Cell(0,0,'หลักสูตร '.iconv('UTF-8','CP874',$row->curNameE).' ระดับ '.iconv('UTF-8','CP874',$row->levelNameEng).' รุ่นที่ '.iconv('UTF-8','CP874',$row->genNo),0,0,'C'); $pdf->Ln(5); if($tmId) { $tm->tmId = $tmId; $tm->get_by_key(TRUE);
$pdf->Cell(0,0,'ภาคการศึกษาที่ '.$tm->tmCode.' ปีการศึกษา '.$acY,0,0,'C'); } else { $pdf->Cell(0,0,'ปีการศึกษา '.$acY,0,0,'C'); } $pdf->Ln(5); $pdf->Cell(0,0,'Student ID '.iconv('UTF-8','CP874',$row->stdCode).' Name (Thai) '.iconv('UTF-8','CP874',$row->prefixName).iconv('UTF-8','CP874',$row->stdName).' '.iconv('UTF-8','CP874',$row->stdSurname),0,0,'C'); $pdf->Ln(5); $pdf->Cell(0,0,'เจ้าของทุน '.iconv('UTF-8','CP874',$row->soName).' จังหวัด '.iconv('UTF-8','CP874',$row->soPrv),0,0,'C');
//print column titles for the actual page $pdf->SetFillColor(232,232,232); $pdf->SetFontSize(12); $pdf->SetY($y_axis_initial); $pdf->SetX($x_axis_initial); $pdf->Cell(20,5,'CODE',1,0,'C',1); $pdf->Cell(110,5,'COURSE',1,0,'C',1); $pdf->Cell(20,5,'CR.',1,0,'C',1); $pdf->Cell(20,5,'GR.',1,0,'C',1); $y_axis = $y_axis_initial + $row_height;
if($tmId!='') { $rs_rd = $rd->getRegistDetailsByStdIdAcYTmId($row->stdId, $acY,$tmId); if ( $rs_rd->num_rows() > 0) { foreach($rs_rd->result() as $row_rd) { $pdf->SetFont('AngsanaNew','',12); $pdf->SetY($y_axis); $pdf->SetX($x_axis_initial); $pdf->Cell(20,5,iconv('UTF-8','CP874',$row_rd->crsCodeE),1,0,'C'); $pdf->Cell(110,5,iconv('UTF-8','CP874',explodeSquare($row_rd->crsNameE)),1,0,'L'); $pdf->Cell(20,5,iconv('UTF-8','CP874',$row_rd->crsUnit),1,0,'C');
if ($row_rd->coDeclareStatus == 'Y') { $pdf->Cell(20,5,iconv('UTF-8','CP874',$row_rd->rdGrade),1,0,'C'); } else { $pdf->Cell(20,5,'',1,0,'C'); }
//Go to next row $y_axis = $y_axis + $row_height; } } }else { $rs_tm = $tm->qryTm(); if ( $rs_tm->num_rows() > 0) { foreach($rs_tm->result() as $row_tm) { $k = 0; $rs_rd = $rd->getRegistDetailsByStdIdAcYTmId($row->stdId, $acY,$row_tm->tmId); if ( $rs_rd->num_rows() > 0) { foreach($rs_rd->result() as $row_rd2) { if(!$k) { $pdf->SetFont('AngsanaNew','B',12); $pdf->SetY($y_axis); $pdf->SetX($x_axis_initial); $pdf->Cell(20,5,'',1,0,'C'); $pdf->Cell(110,5,iconv('UTF-8','CP874',$row_tm->tmNameE),1,0,'C'); $pdf->Cell(20,5,'',1,0,'C'); $pdf->Cell(20,5,'',1,0,'C'); $y_axis = $y_axis + $row_height; }
$pdf->SetFont('AngsanaNew','',12); $pdf->SetY($y_axis); $pdf->SetX($x_axis_initial); $pdf->Cell(20,5,iconv('UTF-8','CP874',$row_rd2->crsCodeE),1,0,'C'); $pdf->Cell(110,5,iconv('UTF-8','CP874',explodeSquare($row_rd2->crsNameE)),1,0,'L'); $pdf->Cell(20,5,iconv('UTF-8','CP874',$row_rd2->crsUnit),1,0,'C');
if ($row_rd2->coDeclareStatus == 'Y') { $pdf->Cell(20,5,iconv('UTF-8','CP874',$row_rd2->rdGrade),1,0,'C'); } else { $pdf->Cell(20,5,'',1,0,'C'); } //Go to next row $y_axis = $y_axis + $row_height;
if($k == $rs_rd->num_rows()-1) { $cond = array('ssmStdId' => $row->stdId, 'ssmAcY' => $acY, 'ssmTmId' => $row_tm->tmId); $qu_ssm2 = $ssm->qrySsm($cond); if ($qu_ssm2->num_rows()) { $row_ssm2 = $qu_ssm2->row(); $gpa = iconv('UTF-8','CP874',$row_ssm2->ssmGPA); $ssmCreditPoint = iconv('UTF-8','CP874',$row_ssm2->ssmCreditPoint); $ssmGPAX = iconv('UTF-8','CP874',$row_ssm2->ssmGPAX); $ssmSumCreditPoint = iconv('UTF-8','CP874',$row_ssm2->ssmSumCreditPoint); } else { $gpa = 0; $ssmCreditPoint = ''; $ssmGPAX = 0; $ssmSumCreditPoint = ''; } $pdf->SetFont('AngsanaNew','B',12); $pdf->SetY($y_axis); $pdf->SetX($x_axis_initial); $pdf->Cell(20,5,'',1,0,'C'); $tmpDivision = $rd->GetAllFDivisorGPAX($row->stdId,$acY,$row_tm->tmId); if($tmpDivision==0) $pdf->Cell(110,5,'SEM-CR.: '.$ssmCreditPoint.' SEM-G.P.A.: '.number_format($gpa, 2).' CUM-CR.: '.$ssmSumCreditPoint.' CUM-G.P.A.: '.number_format(0, 2),1,0,'C'); else $pdf->Cell(110,5,'SEM-CR.: '.$ssmCreditPoint.' SEM-G.P.A.: '.number_format($gpa, 2).' CUM-CR.: '.$ssmSumCreditPoint.' CUM-G.P.A.: '.number_format(($rd->getDividendGPAX($row->stdId,$acY,$row_tm->tmId) / $rd->GetAllFDivisorGPAX($row->stdId,$acY,$row_tm->tmId)), 2),1,0,'C'); $pdf->Cell(20,5,'',1,0,'C'); $pdf->Cell(20,5,'',1,0,'C'); $y_axis = $y_axis + $row_height; } $k++; } } } //$tmId = $row_tm->tmId; } }
$y_axis = $y_axis + $row_height; $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->SetFont('AngsanaNew','',12); $pdf->SetY($y_axis); $pdf->SetX($x_axis_initial); if($tmId) { $pdf->Cell(90,0,'คะแนนเฉลี่ยรายภาคการศึกษา : '.number_format($gpa, 2),0,0,'L'); $pdf->Cell(0,0,'รวมหน่วยกิตรายภาคการศึกษา : '.$ssmCreditPoint,0,0,'L'); } else { $tmpDivision = $rd->GetAllFDivisorAYRGPAX($row->stdId,$acY); if($tmpDivision==0) $pdf->Cell(90,0,'คะแนนเฉลี่ยตลอดปีการศึกษา : '.number_format(0, 2),0,0,'L'); else $pdf->Cell(90,0,'คะแนนเฉลี่ยตลอดปีการศึกษา : '.number_format(($rd->GetDividendAYRGPA($row->stdId,$acY) / $rd->GetAllFDivisorAYRGPAX($row->stdId,$acY) ), 2),0,0,'L'); $pdf->Cell(0,0,'รวมหน่วยกิตตลอดปีการศึกษา : '.$ssm->GetSumCreditPointByStIdAndAcY($row->stdId,$acY),0,0,'L'); } $pdf->Ln(5); $pdf->SetX($x_axis_initial); $pdf->Cell(90,0,'คะแนนเฉลี่ยสะสมตลอดหลักสูตร : '.number_format($row->stdGPA, 2),0,0,'L'); $pdf->Cell(0,0,'รวมหน่วยกิตสะสมตลอดหลักสูตร : '.$ssm->GetSumCreditPointByStId($row->stdId),0,0,'L'); }
/*********************** Grade ***************************/ $y_axis = $y_axis + ($row_height * 2.5); $pdf->SetFont('AngsanaNew','',12); $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); if($rs_grd->num_rows()>0){ 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; } if($typeLang=='T1' || $typeLang=='T2') { $pdf->Cell(35,0,iconv('UTF-8','CP874',$row_grd->grdGrade).' : '.iconv('UTF-8','CP874',$row_grd->grdDescription),0,0,'L'); } else if($typeLang=='E') { $pdf->Cell(35,0,iconv('UTF-8','CP874',$row_grd->grdGrade).' : '.iconv('UTF-8','CP874',$row_grd->grdDescriptionE),0,0,'L'); } $i++; } }
} //End foreach } else { $pdf->AddPage(); $pdf->SetFontSize(18); $pdf->Cell(105); $pdf->SetY(27); $pdf->Cell(0,0,'ไม่มีข้อมูล...',0,0,'C'); } //Create file $pdf->Output(); set_time_limit(30); ?> <!-- <meta http-equiv="refresh" content="0; URL=<?php //echo base_url().$this->config->item('rg_docPdf');?>"> -->
|