Viewing file: v_rptRis125Cur.php (70.81 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//ini_set("memory_limit", $this->config->item('rg_memory_limit'));
ini_set("memory_limit", '1024M');
define('FPDF_FONTPATH', $this->config->item('path_application').'/font/');
//$this->load->library('fpdf_thai');
class FPDF2File extends FPDF
{
var $f;
function Open($file)
{
if(FPDF_VERSION<'1.53')
$this->Error('Version 1.53 or above is required by this extension');
$this->f=fopen($file,'wb');
if(!$this->f)
$this->Error('Unable to create output file: '.$file);
parent::Open();
$this->_putheader();
}
function Image($file,$x,$y,$w=0,$h=0,$type='',$link='')
{
if(!isset($this->images[$file]))
{
//Retrieve only meta-information
$a=getimagesize($file);
if($a===false)
$this->Error('Missing or incorrect image file: '.$file);
$this->images[$file]=array('w'=>$a[0],'h'=>$a[1],'type'=>$a[2],'i'=>count($this->images)+1);
}
parent::Image($file,$x,$y,$w,$h,$type,$link);
}
function Output()
{
if($this->state<3)
$this->Close();
}
function _endpage()
{
parent::_endpage();
//Write page to file
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
$p=($this->compress) ? gzcompress($this->buffer) : $this->buffer;
$this->_newobj();
$this->_out('<<'.$filter.'/Length '.strlen($p).'>>');
$this->_putstream($p);
$this->_out('endobj');
$this->buffer='';
}
function _newobj()
{
$this->n++;
$this->offsets[$this->n]=ftell($this->f);
$this->_out($this->n.' 0 obj');
}
function _out($s)
{
if($this->state==2)
$this->buffer.=$s."\n";
else
fwrite($this->f,$s."\n",strlen($s)+1);
}
function _putimages()
{
$mqr=get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
reset($this->images);
while(list($file,$info)=each($this->images))
{
//Load image
if($info['type']==2)
$info=$this->_parsejpg($file);
elseif($info['type']==3)
$info=$this->_parsepng($file);
elseif($info['type']==1 && method_exists($this,'_parsegif'))
$info=$this->_parsegif($file);
else
$this->Error('Unsupported image type: '.$file);
//Put it into file
$this->_newobj();
$this->images[$file]['n']=$this->n;
$this->_out('<</Type /XObject');
$this->_out('/Subtype /Image');
$this->_out('/Width '.$info['w']);
$this->_out('/Height '.$info['h']);
if($info['cs']=='Indexed')
$this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
else
{
$this->_out('/ColorSpace /'.$info['cs']);
if($info['cs']=='DeviceCMYK')
$this->_out('/Decode [1 0 1 0 1 0 1 0]');
}
$this->_out('/BitsPerComponent '.$info['bpc']);
if(isset($info['f']))
$this->_out('/Filter /'.$info['f']);
if(isset($info['parms']))
$this->_out($info['parms']);
if(isset($info['trns']) && is_array($info['trns']))
{
$trns='';
for($i=0;$i<count($info['trns']);$i++)
$trns.=$info['trns'][$i].' '.$info['trns'][$i].' ';
$this->_out('/Mask ['.$trns.']');
}
$this->_out('/Length '.strlen($info['data']).'>>');
$this->_putstream($info['data']);
unset($info['data']);
$this->_out('endobj');
//Palette
if($info['cs']=='Indexed')
{
$this->_newobj();
$pal=($this->compress) ? gzcompress($info['pal']) : $info['pal'];
$this->_out('<<'.$filter.'/Length '.strlen($pal).'>>');
$this->_putstream($pal);
$this->_out('endobj');
}
}
set_magic_quotes_runtime($mqr);
}
function _putpages()
{
$nb=$this->page;
if($this->DefOrientation=='P')
{
$wPt=$this->fwPt;
$hPt=$this->fhPt;
}
else
{
$wPt=$this->fhPt;
$hPt=$this->fwPt;
}
//Page objects
for($n=1;$n<=$nb;$n++)
{
$this->_newobj();
$this->_out('<</Type /Page');
$this->_out('/Parent 1 0 R');
if(isset($this->OrientationChanges[$n]))
$this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$hPt,$wPt));
$this->_out('/Resources 2 0 R');
if(isset($this->PageLinks[$n]))
{
//Links
$annots='/Annots [';
foreach($this->PageLinks[$n] as $pl)
{
$rect=sprintf('%.2f %.2f %.2f %.2f',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
$annots.='<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
if(is_string($pl[4]))
$annots.='/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>';
else
{
$l=$this->links[$pl[4]];
$h=isset($this->OrientationChanges[$l[0]]) ? $wPt : $hPt;
$annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2f null]>>',2+$nb+$l[0],$h-$l[1]*$this->k);
}
}
$this->_out($annots.']');
}
$this->_out('/Contents '.(2+$n).' 0 R>>');
$this->_out('endobj');
}
//Page root
$this->offsets[1]=ftell($this->f);
$this->_out('1 0 obj');
$this->_out('<</Type /Pages');
$kids='/Kids [';
for($n=1;$n<=$nb;$n++)
$kids.=(2+$nb+$n).' 0 R ';
$this->_out($kids.']');
$this->_out('/Count '.$nb);
$this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$wPt,$hPt));
$this->_out('>>');
$this->_out('endobj');
}
function _putresources()
{
$this->_putfonts();
$this->_putimages();
//Resource dictionary
$this->offsets[2]=ftell($this->f);
$this->_out('2 0 obj');
$this->_out('<<');
$this->_putresourcedict();
$this->_out('>>');
$this->_out('endobj');
}
function _putcatalog()
{
$this->_out('/Type /Catalog');
$this->_out('/Pages 1 0 R');
$n=3+$this->page;
if($this->ZoomMode=='fullpage')
$this->_out('/OpenAction ['.$n.' 0 R /Fit]');
elseif($this->ZoomMode=='fullwidth')
$this->_out('/OpenAction ['.$n.' 0 R /FitH null]');
elseif($this->ZoomMode=='real')
$this->_out('/OpenAction ['.$n.' 0 R /XYZ null null 1]');
elseif(!is_string($this->ZoomMode))
$this->_out('/OpenAction ['.$n.' 0 R /XYZ null null '.($this->ZoomMode/100).']');
if($this->LayoutMode=='single')
$this->_out('/PageLayout /SinglePage');
elseif($this->LayoutMode=='continuous')
$this->_out('/PageLayout /OneColumn');
elseif($this->LayoutMode=='two')
$this->_out('/PageLayout /TwoColumnLeft');
}
function _enddoc()
{
$this->_putpages();
$this->_putresources();
//Info
$this->_newobj();
$this->_out('<<');
$this->_putinfo();
$this->_out('>>');
$this->_out('endobj');
//Catalog
$this->_newobj();
$this->_out('<<');
$this->_putcatalog();
$this->_out('>>');
$this->_out('endobj');
//Cross-ref
$o=ftell($this->f);
$this->_out('xref');
$this->_out('0 '.($this->n+1));
$this->_out('0000000000 65535 f ');
for($i=1;$i<=$this->n;$i++)
$this->_out(sprintf('%010d 00000 n ',$this->offsets[$i]));
//Trailer
$this->_out('trailer');
$this->_out('<<');
$this->_puttrailer();
$this->_out('>>');
$this->_out('startxref');
$this->_out($o);
$this->_out('%%EOF');
$this->state=3;
fclose($this->f);
}
}
class PDF extends FPDF {
var $showCfgClgLogo;
var $cfgClgLogo;
var $cfgClgName;
var $cfgClgNameE;
var $cfgSiteName;
var $cfgMinistry;
var $cfgMinistryE;
var $cfgInstitute;
var $cfgInstituteE;
var $TSREGISTAR;
var $TSREGISTARE;
var $lang;
var $affiliatedTo;
var $affiliatedToName;
var $affiliatedToPos;
var $typePaper;
var $officerId;
var $lineSpacingEng;
var $studentId;
var $directorPos;
var $beforeApprove;
var $tmpFinishDate;
var $honorMedal;
var $qu_std;
var $qu_ac;
var $grd;
var $std;
var $qu_pp;
var $pp_name;
var $pp_nameE;
var $f;
//Page header
function Header() {
$con_std = array('rg_Student.stdId' => $this->studentId);
//print_r($con_std);
$qu_std = $this->std->qryStdJoinAllForRpt($con_std,"","");
//print_r($qu_std); echo "GGG";exit;
/*foreach ($qu_std->result() as $_key=>$_val) {
print_r($_key);
}*/
$row_std = $qu_std->row();
//echo "<pre>";print_r($row_std);exit;
$row_ac = $this->qu_ac->row();
$sdtBirthDate = ($row_std->sdtBirthDate=='0000-00-00') ? '-' : fullDate(splitDateDb2($row_std->sdtBirthDate));
$sdtBirthDateE = ($row_std->sdtBirthDate=='0000-00-00') ? '-' : fullDateEng(splitDateDb2($row_std->sdtBirthDate));
//Logo
if($this->showCfgClgLogo)
$this->Image($this->cfgClgLogo,8,1,34,29);
$this->Image('uploads/eregis/picture/logo_watermark.jpg',60,72,90,0);
if($this->lang == 'T1' || $this->lang == 'T2') {
if ($this->honorMedal == 'H') {
if ($row_std->stdHonor) {
eval("\$str = 'acHonor".$row_std->stdHonor."';");
$str = $row_ac->$str;
}else{
$str = '';
}
} else if ($this->honorMedal == 'M') {
eval("\$str = 'acMedal".$row_std->stdMedal."';");
if ($row_std->stdMedal) {
$str = $row_ac->$str;
}else{
$str = '';
}
}
//Title
$this->SetY(6);
$this->SetFont('AngsanaNew','B',17);
$this->Cell(0,6,'ระเบียนแสดงผลการเรียน',0,0,'C');
$this->Ln(6);
$this->SetFont('AngsanaNew','B',16);
$this->Cell(0,6,(($this->lang == 'T2') ? a2th($this->cfgInstitute.' '.$this->cfgMinistry) : th2a($this->cfgInstitute.' '.$this->cfgMinistry)),0,0,'C');
//$this->Ln(6);
//$this->Cell(0,6,(($this->lang == 'T2') ? a2th($this->facultyCode == 1 ? 'คณะพยาบาลศาสตร์':'คณะสาธารณสุขศาสตร์และสหเวชศาสตร์') : th2a($this->facultyCode == 1 ? 'คณะพยาบาลศาสตร์':'คณะสาธารณสุขศาสตร์และสหเวชศาสตร์')),0,0,'C');
$this->Ln(6);
$this->Cell(0,6,(($this->lang == 'T2') ? a2th($this->cfgClgName) : th2a($this->cfgClgName)),0,0,'C');
$this->Ln(5);
//$this->SetY(29);
$tmpEdg = explode('^',$row_std->sdtEdgName);
if($this->affiliatedTo || count($tmpEdg) >= 2){
$this->SetY(29);
}else{
$this->SetY(29);
}
$this->SetX(5);
$this->SetFont('AngsanaNew','B',14);
$this->Cell(20,5,'รหัสนักศึกษา: ',0,0,'L');
$this->SetFont('');
$this->Cell(80,5,iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th($row_std->stdCode) : th2a($row_std->stdCode))),0,0,'L');
$this->SetFont('AngsanaNew','B');
$this->Cell(29,5,'วันที่เข้ารับการศึกษา: ',0,0,'L');
$this->SetFont('');
$this->Cell(0,5,iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th(fullDate(splitDateDb2($row_std->stdAdmitDate))) : th2a(fullDate(splitDateDb2($row_std->stdAdmitDate))))),0,0,'L');
$this->Ln(5);
$this->SetX(5);
$this->SetFont('AngsanaNew','B');
$this->Cell(27,5,'ชื่อ-นามสกุล (ไทย): ',0,0,'L');
$this->SetFont('');
$this->Cell(73,5,iconv('UTF-8','TIS-620',$row_std->prefixName).iconv('UTF-8','TIS-620',$row_std->stdName).' '.iconv('UTF-8','TIS-620',$row_std->stdSurname),0,0,'L');
$this->SetFont('AngsanaNew','B');
$this->Cell(29,5,'วันที่สำเร็จการศึกษา: ',0,0,'L');
$this->SetFont('');
if($row_std->stdGraduateDate == '0000-00-00') {
if($this->beforeApprove)
$this->Cell(0,5,iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th(fullDate($this->tmpFinishDate)) : th2a(fullDate($this->tmpFinishDate)))),0,0,'L');
else
$this->Cell(0,5,'-',0,0,'L');
} else {
$this->Cell(0,5,iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th(fullDate(splitDateDb2($row_std->stdGraduateDate))) : th2a(fullDate(splitDateDb2($row_std->stdGraduateDate))))),0,0,'L');
}
if(!$this->affiliatedTo && count($tmpEdg) == 2){
$this->Ln(4);
}else{
$this->Ln(5);
}
$this->SetX(5);
$this->SetFont('AngsanaNew','B');
$this->Cell(14,5,'(อังกฤษ): ',0,0,'L');
$this->SetFont('AngsanaNew','',14);
$this->Cell(86,5.7,$row_std->prefixNameEng.' '.$row_std->stdNameE.' '.$row_std->stdSurnameE,0,0,'L');
$this->SetFont('AngsanaNew','B',14);
$this->Cell(19,5,'วุฒิการศึกษา: ',0,0,'L');
$this->SetFont('');
$tmpDg = explode('^', iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th($row_std->cEdgName) : th2a($row_std->cEdgName))));
$this->Cell(0,5,$this->affiliatedTo && count($tmpDg)==1 ? $tmpDg[0].' ' : $tmpDg[0],0,0,'L');
$this->Ln(5);
$this->SetX(5);
$this->SetFont('AngsanaNew','B');
$this->Cell(13,5,'วันที่เกิด: ',0,0,'L');
$this->SetFont('');
$this->Cell(87.5,5,iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th($sdtBirthDate) : th2a($sdtBirthDate))),0,0,'L');
if($this->affiliatedTo || count($tmpDg)!=1) {
$this->Cell(19,'');
$this->Cell(0,5,$this->affiliatedTo ? count($tmpDg)==1 ? iconv('UTF-8','TIS-620',$this->affiliatedTo) : $tmpDg[1].' '.iconv('UTF-8','TIS-620',$this->affiliatedTo) : $tmpDg[1],0,0,'L');
}else{
$this->SetFont('AngsanaNew','B');
if ($this->honorMedal == 'H') {
$this->Cell(16.5,5,'เกียรตินิยม: ',0,0,'L');
} else if ($this->honorMedal == 'M') {
$this->Cell(0,5,'เหรียญรางวัล: ',0,0,'L');
} else {
$this->Cell(0,5,'',0,0,'L');
}
$this->SetFont('');
if ($this->honorMedal <> 'N') {
if($str)
$this->Cell(0,5,iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th($str) : th2a($str))),0,0,'L');
else
$this->Cell(0,5,'-',0,0,'L');
}
}
$this->Ln(5);
$this->SetX(5);
$this->SetFont('AngsanaNew','B');
$this->Cell(18.5,5,'จังหวัดที่เกิด: ',0,0,'L');
$this->SetFont('');
$this->Cell(81.5,5,iconv('UTF-8','TIS-620',$row_std->provinceName),0,0,'L');
if($this->affiliatedTo || count($tmpDg)!=1) {
$this->SetFont('AngsanaNew','B');
if ($this->honorMedal == 'H') {
$this->Cell(17,5,'เกียรตินิยม: ',0,0,'L');
} else if ($this->honorMedal == 'M') {
$this->Cell(20,5,'เหรียญรางวัล: ',0,0,'L');
} else {
$this->Cell(0,5,'',0,0,'L');
}
$this->SetFont('');
if ($this->honorMedal <> 'N') {
if($str)
$this->Cell(0,5,iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th($str) : th2a($str))),0,0,'L');
else
$this->Cell(0,5,'-',0,0,'L');
}
}else{
$this->SetFont('AngsanaNew','B');
$this->Cell(24,5,'วุฒิการศึกษาเดิม: ',0,0,'L');
$this->SetFont('');
//$tmpEdg = explode('^',$row_std->sdtEdgName);
if(count($tmpEdg) >=1 ){
$this->Cell(0,5,iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th($tmpEdg[0]) : th2a($tmpEdg[0]))),0,0,'L');
}else{
$this->Cell(0,5,iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th($row_std->sdtEdgName) : th2a($row_std->sdtEdgName))),0,0,'L');
}
if(count($tmpEdg) >= 1){
$this->Ln(5);
$this->SetX(5);
$this->SetFont('AngsanaNew','B');
$this->Cell(12,5,'สัญชาติ: ',0,0,'L');
$this->SetFont('');
$this->Cell(30,5,iconv('UTF-8','TIS-620',$row_std->nationName),0,0,'L');
//$this->Cell(isset($tmpEdg) ? count($tmpEdg) >= 2 ? 38:88.5:38,5,iconv('UTF-8','TIS-620',$row_std->nationName),0,0,'L');
$this->SetFont('AngsanaNew','B');
$this->Cell(11.5,5,'ศาสนา: ',0,0,'L');
$this->SetFont('');
$this->Cell(63,5,iconv('UTF-8','TIS-620',$row_std->religionName),0,0,'L');
$this->Cell(0,5,iconv('UTF-8','TIS-620',$tmpEdg[1]),0,0,'L');
}
}
$this->Ln(4);
$this->SetX(5);
if($this->affiliatedTo || count($tmpDg)!=1){
$this->SetFont('AngsanaNew','B');
$this->Cell(12,5,'สัญชาติ: ',0,0,'L');
$this->SetFont('');
$this->Cell(isset($tmpEdg) ? count($tmpEdg) >= 2 ? 38:$this->affiliatedTo ? 38:88.5:38,5,iconv('UTF-8','TIS-620',$row_std->nationName),0,0,'L');
$this->SetFont('AngsanaNew','B');
$this->Cell(11.5,5,'ศาสนา: ',0,0,'L');
$this->SetFont('');
$this->Cell(38.5,5,iconv('UTF-8','TIS-620',$row_std->religionName),0,0,'L');
}
if($this->affiliatedTo || count($tmpDg)!=1) {
$this->SetFont('AngsanaNew','B');
$this->Cell(24,5,'วุฒิการศึกษาเดิม: ',0,0,'L');
$this->SetFont('');
if(count($tmpEdg) >= 2){
$this->Cell(0,5,iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th($tmpEdg[0]).count($tmpDg) : th2a($tmpEdg[0]).count($tmpDg))),0,0,'L');
$this->Ln(4);
$this->Cell(119,'');
$this->Cell(0,5,iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th($tmpEdg[1]) : th2a($tmpEdg[1]))),0,0,'L');
}else{
$this->Cell(0,5,iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th($row_std->sdtEdgName) : th2a($row_std->sdtEdgName))),0,0,'L');
}
}else{
if($this->affiliatedTo){
$this->Cell(0,5,iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th($tmpEdg[1]) :th2a($tmpEdg[1]))),0,0,'L');
}
}
} else if($this->lang == 'E') {
if ($this->honorMedal == 'H') {
eval("\$str = 'acHonor".$row_std->stdHonor."E';");
if ($row_std->stdHonor) {
$str = $row_ac->$str;
}else{
$str = '';
}
} else if ($this->honorMedal == 'M') {
eval("\$str = 'acMedal".$row_std->stdMedal."E';");
if ($row_std->stdMedal) {
$str = $row_ac->$str;
}else{
$str = '';
}
}
//Title
$this->SetY(2);
$this->SetFont('AngsanaNew','B',17);
$this->Cell(0,6,'Official Transcript of Academic Record ',0,0,'C');
$this->Ln(6);
$this->Cell(0,6,$this->cfgInstituteE,0,0,'C');
$this->Ln(6);
$this->SetFont('AngsanaNew','B',16);
$this->Cell(0,6,$this->facultyCode == 1 ? 'Faculty of Nursing':'Faculty of Public Health and Allied Health Sciences',0,0,'C');
$this->Ln(6);
$this->Cell(0,6,$this->cfgClgNameE,0,0,'C');
$tmpEdg = explode('^', $row_std->sdtEdgNameE);
if($this->affiliatedTo && count($tmpEdg) >=2 ){
$this->SetY(26);
}else{
$this->SetY(29);
}
//$this->SetY(29);
$this->SetX(5);
$this->SetFont('AngsanaNew','B',14);
$this->Cell(17.5,5,'Student ID: ',0,0,'L');
$this->SetFont('');
$this->Cell(82.5,5,$row_std->stdCode,0,0,'L');
$this->SetFont('AngsanaNew','B');
$this->Cell(27.5,5,'Date of Admission: ',0,0,'L');
$this->SetFont('');
$this->Cell(0,5,fullDateEng(splitDateDb2($row_std->stdAdmitDate)),0,0,'L');
if($this->affiliatedTo && count($tmpEdg) >=2){
$this->Ln(4.5);
}else{
$this->Ln(5);
}
$this->SetX(5);
$this->SetFont('AngsanaNew','B');
$this->Cell(20,5,'Name (Thai): ',0,0,'L');
$this->SetFont('');
$this->Cell(80,5,iconv('UTF-8','TIS-620',$row_std->prefixName).iconv('UTF-8','TIS-620',$row_std->stdName).' '.iconv('UTF-8','TIS-620',$row_std->stdSurname),0,0,'L');
$this->SetFont('AngsanaNew','B');
$this->Cell(29.5,5,'Date of Graduation: ',0,0,'L');
$this->SetFont('');
if($row_std->stdGraduateDate == '0000-00-00') {
if($this->beforeApprove)
$this->Cell(0,5,fullDateEng($this->tmpFinishDate),0,0,'L');
else
$this->Cell(0,5,'-',0,0,'L');
}
else
$this->Cell(0,5,fullDateEng(splitDateDb2($row_std->stdGraduateDate)),0,0,'L');
if($this->affiliatedTo && count($tmpEdg) >=2){
$this->Ln(4.5);
}else{
$this->Ln(5);
}
$this->SetX(5);
$this->SetFont('AngsanaNew','B');
$this->Cell(15,5,'(English): ',0,0,'L');
$this->SetFont('AngsanaNew','',14);
$this->Cell(85,5.7,$row_std->prefixNameEng.' '.$row_std->stdNameE.' '.$row_std->stdSurnameE,0,0,'L');
$this->SetFont('AngsanaNew','B',14);
$this->Cell(12,5,'Degree: ',0,0,'L');
$this->SetFont('');
$tmpDg = explode('^', $row_std->cEdgNameE);
$this->Cell(0,5,$this->affiliatedTo && count($tmpDg)==1 ? $tmpDg[0].',' : $tmpDg[0],0,0,'L');
if($this->affiliatedTo && count($tmpEdg) >=2){
$this->Ln(4.5);
}else{
$this->Ln(5);
}
$this->SetX(5);
$this->SetFont('AngsanaNew','B');
$this->Cell(20,5,'Date of Birth: ',0,0,'L');
$this->SetFont('');
$this->Cell(80,5,$sdtBirthDateE,0,0,'L');
if($this->affiliatedTo || count($tmpDg)!=1){
$this->Cell(12,'');
$this->Cell(0,5,$this->affiliatedTo ? count($tmpDg)==1 ? iconv('UTF-8','TIS-620',$this->affiliatedTo) : $tmpDg[1].', '.iconv('UTF-8','TIS-620',$this->affiliatedTo) : $tmpDg[1],0,0,'L');
}else{
$this->SetFont('AngsanaNew','B');
if ($this->honorMedal == 'H') {
$this->Cell(12,5,'Honour: ',0,0,'L');
} else if ($this->honorMedal == 'M') {
$this->Cell(0,5,'Medal Award: ',0,0,'L');
} else {
$this->Cell(0,5,'',0,0,'L');
}
$this->SetFont('');
if ($this->honorMedal <> 'N') {
if($str)
$this->Cell(0,5,$str,0,0,'L');
else
$this->Cell(0,5,'-',0,0,'L');
}
}
$this->Ln(5);
$this->SetX(5);
$this->SetFont('AngsanaNew','B');
$this->Cell(21,5,'Place of Birth: ',0,0,'L');
$this->SetFont('');
$this->Cell(79,5,$row_std->provinceNameEng,0,0,'L');
$this->SetFont('AngsanaNew','B');
if(!$this->affiliatedTo){
$this->Cell(36,5,'Admission Requirement: ',0,0,'L');
$this->SetFont('');
if(count($tmpEdg) >=1){
$this->Cell(0,5,$tmpEdg[0],0,0,'L');
}
else{
$this->Cell(0,5,$row_std->sdtEdgNameE,0,0,'L');
}
}
$this->SetFont('AngsanaNew','B');
if($this->affiliatedTo){
if ($this->honorMedal == 'H') {
$this->Cell(13,5,'Honour: ',0,0,'L');
} else if ($this->honorMedal == 'M') {
$this->Cell(21,5,'Medal Award: ',0,0,'L');
} else {
$this->Cell(0,5,'',0,0,'L');
}
$this->SetFont('');
if ($this->honorMedal <> 'N') {
if($str)
$this->Cell(0,5,$str,0,0,'L');
else
$this->Cell(0,5,'-',0,0,'L');
}
$this->Ln(5);
}
if(!$this->affiliatedTo){
$this->Ln(5);
}
$this->SetX(5);
$this->SetFont('AngsanaNew','B');
$this->Cell(11.5,5,'Nation: ',0,0,'L');
$this->SetFont('');
//$this->Cell(isset($tmpEdg) ? count($tmpEdg) >= 2 ? 38:$this->affiliatedTo ? 38:88.5:38,5,$row_std->nationNameEng,0,0,'L');
$this->Cell(30.5,5,$row_std->nationNameEng,0,0,'L');
$this->SetFont('AngsanaNew','B');
$this->Cell(13.5,5,'Religion: ',0,0,'L');
if(!$this->affiliatedTo){
$this->SetFont('');
$this->Cell(20.5,5,$row_std->religionNameEng,0,0,'L');
if(count($tmpEdg) >= 2){
$this->Cell(0,1,$tmpEdg[1],0,0,'L');
}
}
$this->SetFont('');
if($this->affiliatedTo){
$this->Cell($this->affiliatedTo ? 36.5:10,5,$row_std->religionNameEng,0,0,'L');
$this->SetFont('AngsanaNew','B');
$this->Cell(36,5,'Admission Requirement: ',0,0,'L');
$this->SetFont('');
if(count($tmpEdg) >=1){
$this->Cell(0,5,$tmpEdg[0],0,0,'L');
}
else{
$this->Cell(0,5,$row_std->sdtEdgNameE,0,0,'L');
}
if(count($tmpEdg) >= 2){
$this->Ln(5);
$this->Cell(130,'');
$this->Cell(0,5,$tmpEdg[1],0,0,'L');
}
}
}
//print column titles for the actual page
$this->SetFont('AngsanaNew','B',14);
$this->SetY(60);
$this->SetX(5);
if($this->lang == 'T1' || $this->lang == 'T2') {
$this->Cell(17,6,'รหัสรายวิชา',1,0,'C');
$this->Cell(57,6,'ชื่อรายวิชา',1,0,'C');
$this->Cell(13,6,'หน่วยกิต',1,0,'C');
$this->Cell(13,6,'เกรด',1,0,'C');
$this->Cell(17,6,'รหัสรายวิชา',1,0,'C');
$this->Cell(57,6,'ชื่อรายวิชา',1,0,'C');
$this->Cell(13,6,'หน่วยกิต',1,0,'C');
$this->Cell(13,6,'เกรด',1,0,'C');
}
else if($this->lang == 'E') {
$this->Cell(15,6,'CODE',1,0,'C');
$this->Cell(69,6,'COURSE',1,0,'C');
$this->Cell(8,6,'CR.',1,0,'C');
$this->Cell(8,6,'GR.',1,0,'C');
$this->Cell(15,6,'CODE',1,0,'C');
$this->Cell(69,6,'COURSE',1,0,'C');
$this->Cell(8,6,'CR.',1,0,'C');
$this->Cell(8,6,'GR.',1,0,'C');
}
$this->SetY(66);
$this->SetX(5);
if($this->typePaper == 'A4') {
if($this->lang=='E' && $this->lineSpacingEng==4)
$heightCell = 196;
else
$heightCell = 195;
}
else {
if($this->lang=='E' && $this->lineSpacingEng==4)
$heightCell = 260;
else
$heightCell = 260;
}
$this->Cell(100,$heightCell,'',1,0,'L');
$this->Cell(100,$heightCell,'',1,0,'L');
}
//Page footer
function Footer()
{
$con_std = array('rg_Student.stdId' => $this->studentId);
$qu_std = $this->std->qryStdJoinAllForRpt($con_std,"","");
$row_std = $qu_std->row();
if($this->typePaper == 'A4')
$y_axis = 262;
else
$y_axis = 326;
$this->SetFont('AngsanaNew','B',12);
$this->SetY($y_axis);
$this->SetX(5);
if($this->lang == 'T1' || $this->lang == 'T2')
$this->Cell(0,5,'ความหมายเกรด:',0,0,'L');
else if($this->lang == 'E')
$this->Cell(0,5,'Grading System:',0,0,'L');
$y_axis = $y_axis + 4;
$x_axis = 5;
$rs_grd = $this->grd->qryGrdJoinCur($row_std->stdCurId);
//print_r($rs_grd);
foreach ($rs_grd->result() as $row_grd) {
$flag = 0;
$this->SetFont('');
$this->SetY($y_axis);
$this->SetX($x_axis);
if($row_grd->grdPoint == 0) {
if($row_grd->grdGrade!='I' && $row_grd->grdGrade!='E' && $row_grd->grdGrade!='P' && $row_grd->grdGrade!='X') {
$this->Cell(5,5,$row_grd->grdGrade,0,0,'L');
if($this->lang == 'T1' || $this->lang == 'T2')
$this->Cell(28,5,': '.iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th($row_grd->grdDescription) : th2a($row_grd->grdDescription))),0,0,'L');
else if($this->lang == 'E')
$this->Cell(28,5,': '.$row_grd->grdDescriptionE,0,0,'L');
$flag = 1;
}
}
else {
$this->Cell(5,5,$row_grd->grdGrade,0,0,'L');
if($this->lang == 'T1' || $this->lang == 'T2')
$this->Cell(28,5,': '.iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th(number_format($row_grd->grdPoint, 2)) : th2a(number_format($row_grd->grdPoint, 2)))).' ('.iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th($row_grd->grdDescription) : th2a($row_grd->grdDescription))).')',0,0,'L');
else if($this->lang == 'E')
$this->Cell(28,5,': '.number_format($row_grd->grdPoint, 2).' ('.$row_grd->grdDescriptionE.')',0,0,'L');
$flag = 1;
}
if($flag) {
//Go to next row
if($x_axis >= 165) {
$y_axis = $y_axis + 4;
$x_axis = 5;
}
else
$x_axis = $x_axis + 33;
}
} //End while
if($this->lang == 'E'){
$this->Cell(28,5,'P'.' '.' '.' '.' '.' '.':Pass' ,0,0,'L');
}
$y_axis = $y_axis + 8;
/*if($this->affiliatedToName && $this->affiliatedToPos)
$widthCell = 66;
else
$widthCell = 100;
$this->SetY($y_axis);
$this->SetX(5);
$this->Cell($widthCell,5,'..................................................',0,0,'C');
$this->Cell($widthCell,5,'..................................................',0,0,'C');
if($this->affiliatedToName && $this->affiliatedToPos)
$this->Cell($widthCell,5,'..................................................',0,0,'C');
$y_axis = $y_axis + 4;
$this->SetY($y_axis);
$this->SetX(5);
// TSRegistrar
if($this->lang == 'T1' || $this->lang == 'T2')
$this->Cell($widthCell,5,'('.iconv('UTF-8','TIS-620',$this->TSREGISTAR).')',0,0,'C');
else if($this->lang == 'E')
$this->Cell($widthCell,5,'('.iconv('UTF-8','TIS-620',$this->TSREGISTARE).')',0,0,'C');
// director
if($this->lang == 'T1' || $this->lang == 'T2')
$this->Cell($widthCell,5,'('.iconv('UTF-8','TIS-620',$this->pp_name).')',0,0,'C');
else if($this->lang == 'E')
$this->Cell($widthCell,5,'('.$this->pp_nameE.')',0,0,'C');
// affiliatedToName
if($this->affiliatedToName && $this->affiliatedToPos)
$this->Cell($widthCell,5,'('.iconv('UTF-8','TIS-620',(($this->lang == 'T2') ? a2th($this->affiliatedToName) : th2a($this->affiliatedToName))).')',0,0,'C');
$y_axis = $y_axis + 4;
$this->SetY($y_axis);
$this->SetX(5);
if($this->lang == 'T1' || $this->lang == 'T2') {
$this->Cell($widthCell,5,'นายทะเบียน',0,0,'C');
$this->Cell($widthCell,5,$this->directorPos ? iconv('UTF-8','TIS-620',$this->directorPos) : 'ผู้อำนวยการ',0,0,'C');
}
else if($this->lang == 'E') {
$this->Cell($widthCell,5,'Registrar',0,0,'C');
$this->Cell($widthCell,5,$this->directorPos ? iconv('UTF-8','TIS-620',$this->directorPos) : 'Director',0,0,'C');
}
if($this->affiliatedToName && $this->affiliatedToPos)
$this->Cell($widthCell,5,iconv('UTF-8','TIS-620',$this->affiliatedToPos),0,0,'C');*/
//$y_axis = $y_axis + 2;
//$this->SetY($y_axis);
//$this->SetX(10);
if($this->lang == 'T1' || $this->lang == 'T2') {
$this->Ln(4);
$this->Cell($widthCell,5,'..........................................................................',0,0,'C');
$this->Ln(4);
$this->Cell($widthCell,5,'('.iconv('UTF-8','TIS-620',$this->pp_name).')',0,0,'C');
$this->Ln(4);
$this->Cell($widthCell,5,'ผู้อำนวยการ'.$this->cfgClgName,0,0,'C');
$this->Ln(4);
$this->Cell($widthCell,5,'นายทะเบียน',0,0,'C');
//$this->Cell($widthCell,5,$this->directorPos ? iconv('UTF-8','TIS-620',$this->directorPos) : 'ผู้อำนวยการ',0,0,'C');
}else if($this->lang == 'E'){
$this->Ln(4);
$this->Cell($widthCell,5,'..........................................................................',0,0,'C');
$this->Ln(4);
$this->Cell($widthCell,5,'('.iconv('UTF-8','TIS-620',$this->pp_nameE).')',0,0,'C');
$this->Ln(4);
$this->Cell($widthCell,5,'Director of '.$this->cfgClgNameE,0,0,'C');
$this->Ln(4);
$this->Cell($widthCell,5,'Registrar',0,0,'C');
}
}
}
if ($qu_std->num_rows()) {
//Create new pdf file
if($typePaper == 'A4') {
$pdf=new PDF();
} else {
$pdf=new PDF('P', 'mm', array(210, 360));
}
//$pdf->cfgClgLogo = "images/eregis/picture/logo_head.jpg";
$pdf->cfgClgLogo = $this->config->item('rg_upload_picture').$cfgClgLogo;
$pdf->cfgClgName = iconv('UTF-8','TIS-620',$cfgClgName);
$pdf->cfgClgNameE = iconv('UTF-8','TIS-620',$cfgClgNameE);
$pdf->cfgSiteName = iconv('UTF-8','TIS-620',$cfgSiteName);
$pdf->cfgInstitute = iconv('UTF-8','TIS-620',$cfgInstitute);
$pdf->cfgInstituteE = iconv('UTF-8','TIS-620',$cfgInstituteE);
$pdf->cfgMinistry = iconv('UTF-8','TIS-620',$cfgMinistry);
$pdf->cfgMinistryE = iconv('UTF-8','TIS-620',$cfgMinistryE);
$pdf->showCfgClgLogo = $showCfgClgLogo;
$pdf->TSREGISTAR = $TSREGISTAR;
$pdf->TSREGISTARE = $TSREGISTARE;
$pdf->lang = $typeLang;
$pdf->affiliatedTo = $affiliatedTo;
$pdf->affiliatedToName = $affiliatedToName;
$pdf->affiliatedToPos = $affiliatedToPos;
$pdf->typePaper = $typePaper;
$pdf->lineSpacingEng = $lineSpacingEng;
$pdf->officerId = $officerId;
$pdf->directorPos = $directorPos;
$pdf->beforeApprove = $beforeApprove;
$pdf->tmpFinishDate = $tmpFinishDate;
$pdf->honorMedal = $honorMedal;
$pdf->qu_std = $qu_std;
$pdf->qu_ac = $qu_ac;
$pdf->grd = $grd;
$pdf->std = $std;
$pdf->facultyCode = $facultyCode;
if($qu_pp->num_rows()) {
$row_pp = $qu_pp->row();
$pdf->pp_name = $row_pp->name;
$pdf->pp_nameE = $row_pp->nameE;
}
//Set thai font
$pdf->SetThaiFont();
$pdf->AliasNbPages();
//Open file
//$pdf->Open();
$pdf->Open(base_url().$this->config->item('rg_docPdf'));
//Disable automatic page break
$pdf->SetAutoPageBreak(false);
//Set initial x position of table
$x_axis_initial = 5;
// $row_height = ($typeLang=='T1' || $typeLang=='T2') ? 5 : $lineSpacingEng;
// 19/2/2556 sitthichai edit
$row_height = $lineSpacingEng;
set_time_limit(0);
//Set initial y axis position per page
//Set maximum rows per page
if($typePaper=='A4') {
if($typeLang=='E' && $lineSpacingEng==4) {
$y_axis_initial = 62;
$max = 49;
}elseif($typeLang!='E' && $lineSpacingEng==4){ // 19/2/2556 sitthichai edit
$y_axis_initial = 62;
$max = 48;
}else {
$y_axis_initial = 61;
$max = 39;
}
}
else {
if($typeLang=='E' && $lineSpacingEng==4) {
$y_axis_initial = 62;
$max = 65;
}elseif($typeLang!='E' && $lineSpacingEng==4){ // 19/2/2556 sitthichai edit
$y_axis_initial = 62;
$max = 64;
}else {
$y_axis_initial = 61;
$max = 52;
}
}
// ****************************** TypeSt ******************************
if($typeSt=='N' && $qu_std->num_rows()) {
// find student
$cntSt = 0;
//echo "<pre>"; print_r($qu_std); exit;
if($qu_std->num_rows()) {
foreach ($qu_std->result() as $row_std) {
//echo "<pre>"; print_r($row_std);exit;
if($cntSt != 0)
$y_xis = 0;
//$row_std = $qu_std->row();
$pdf->studentId = $row_std->stdId;
//$pdf->Image($this->config->item('path_application').'/asset/img/logo_watermark.jpg',60,75,85,0,'jpg');
$pdf->AddPage();
//$pdf->Image($this->config->item('path_application').'/asset/img/logo_watermark.jpg',60,75,85,0,'jpg');
// ****************************** Thai ******************************
if($typeLang=='T1' || $typeLang=='T2') {
//Picture
$pdf->SetY(2);
$pdf->SetX(180);
if($showStPic && $row_std->sdtPicturePath != '') {
$pdf->Cell(25,30,'',1,0,'C');
$pdf->Image($this->config->item('rg_pictureStd').$row_std->sdtPicturePath,181,3,23,28);
}
$page = 0;
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
// ****************************** Thai+Semester ******************************
if($typeDisplay == 'S') {
$i = 0;
$j = 0;
$con_ssm = array('ssmStdId' => $row_std->stdId);
$rs_ssm = $ssm->qrySsmJoinTm($con_ssm);
//echo $this->db->last_query();
foreach ($rs_ssm->result() as $row_ssm) {
if(($i + 1) >= $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
//if($page == $max*2) {
if($page > $max) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$pdf->SetFont('AngsanaNew','B',12);
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(100,5,iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_ssm->tmName) : th2a($row_ssm->tmName))).' ปีการศึกษา '.iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_ssm->ssmAcY) : th2a($row_ssm->ssmAcY))),0,0,'C');
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
$rs_rd = $rd->getRegistDetailsByStdIdAcYTmId($row_std->stdId,$row_ssm->ssmAcY,$row_ssm->tmId);
//echo $this->db->last_query();
foreach ($rs_rd->result() as $row_rd) {
$tmp = explode('^', iconv('UTF-8','TIS-620',$row_rd->crsName));
if(($i != $max) && (($i+count($tmp)) > $max)) {
$page = $page + ($max - $i);
$i = $i + ($max - $i);
}
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$tmp_y_axis = $y_axis;
$pdf->SetFont('');
$pdf->SetY($tmp_y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(17,5,iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_rd->crsCode) : th2a($row_rd->crsCode))),0,0,'L');
$pdf->CellFitScale(57,5,$tmp[0],0,0,'L');
//Go to next row
$tmp_y_axis = $tmp_y_axis + $row_height;
$cnt = 1;
if (isset($tmp[$cnt])) {
for ($cnt = 1; $cnt<count($tmp); $cnt++) {
$pdf->SetY($tmp_y_axis);
$pdf->SetX($x_axis+17);
$pdf->Cell(57,5,$tmp[$cnt],0,0,'L');
//Go to next row
$tmp_y_axis = $tmp_y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis+17+57);
$pdf->Cell(15,5,iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_rd->rdCreditAttempt) : th2a($row_rd->rdCreditAttempt))),0,0,'C');
$pdf->Cell(15,5,' '.iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? "".a2th($row_rd->rdGrade) : "".th2a($row_rd->rdGrade))),0,0,'C'); //ไทย - เลขอารบิก/ภาคการศึกษา
//Go to next row
$y_axis = $y_axis + ($row_height * $cnt);
$i = $i + 1;
$page = $page + 1;
} //End while
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$pdf->SetFont('AngsanaNew','B',12);
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
if($j == 0)
$pdf->Cell(100,5,'หน่วยกิต: '.iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_ssm->ssmCreditPoint) : th2a($row_ssm->ssmCreditPoint))).' คะแนนเฉลี่ย: '.iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th(number_format($row_ssm->ssmGPA, 2)) : th2a(number_format($row_ssm->ssmGPA, 2)))),0,0,'C');
else
$pdf->Cell(100,5,'หน่วยกิต: '.iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_ssm->ssmCreditPoint) : th2a($row_ssm->ssmCreditPoint))).' คะแนนเฉลี่ย: '.iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th(number_format($row_ssm->ssmGPA, 2)) : th2a(number_format($row_ssm->ssmGPA, 2)))).' หน่วยกิตสะสม: '.iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_ssm->ssmSumCreditPoint) : th2a($row_ssm->ssmSumCreditPoint, 2))).' คะแนนเฉลี่ยสะสม: '.iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th(number_format($row_ssm->ssmGPAX, 2)) : th2a(number_format($row_ssm->ssmGPAX, 2)))),0,0,'C');
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
$j = $j + 1;
} //End while
} // end Thai+Semester
// ****************************** Thai+Group ******************************
else if($typeDisplay == 'G') {
$i = 0;
//$j = 0;
$rs_cs = $cs->qryCsCdId1ByCsCurId($row_std->stdCurId);
foreach ($rs_cs->result() as $row_cs) {
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
//if($page == $max*2) {
if($page > $max) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$pdf->SetFont('AngsanaNew','B',12);
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(100,5,iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_cs->cdName) : th2a($row_cs->cdName))),0,0,'C');
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
$con_rd = array('rdStdId' => $row_std->stdId, 'rdCdId1' => $row_cs->csCdId1);
$ord_rd = array('coId' => '');
$rs_rd = $rd->qryRdJnCrsOpCrs($con_rd,$ord_rd);
//echo $this->db->last_query();
foreach ($rs_rd->result() as $row_rd) {
$tmp = explode('^', iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_rd->crsName) : th2a($row_rd->crsName))));
if(($i != $max) && (($i+count($tmp)) > $max)) {
$page = $page + ($max - $i);
$i = $i + ($max - $i);
}
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$tmp_y_axis = $y_axis;
$pdf->SetFont('');
$pdf->SetY($tmp_y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(17,5,iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_rd->crsCode) : th2a($row_rd->crsCode))),0,0,'');
$pdf->CellFitScale(57,5,$tmp[0],0,0,'L');
//Go to next row
$tmp_y_axis = $tmp_y_axis + $row_height;
$cnt = 1;
if (isset($tmp[$cnt])) {
for ($cnt = 1; $cnt<count($tmp); $cnt++) {
$pdf->SetY($tmp_y_axis);
$pdf->SetX($x_axis+17);
$pdf->Cell(57,5,$tmp[$cnt],0,0,'L');
//Go to next row
$tmp_y_axis = $tmp_y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis+17+57);
$pdf->Cell(16,5,iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_rd->rdCreditAttempt) : th2a($row_rd->rdCreditAttempt))),0,0,'C');
$pdf->Cell(14,5,' '.iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? " ".a2th($row_rd->rdGrade) : " ".th2a($row_rd->rdGrade))),0,0,'L'); // //ไทย - เลขอารบิก / รายหมวดวิชา
//Go to next row
$y_axis = $y_axis + ($row_height * $cnt);
$i = $i + 1;
$page = $page + 1;
} //End while
} //End while
$maxAcY = $ssm->getMaxAcYByStdId($row_std->stdId);
$maxSe = $ssm->getMaxTmIdByStdIdAcY($row_std->stdId, $maxAcY);
$con_ssm2 = array('ssmStdId' => $row_std->stdId, 'ssmAcY' => $maxAcY, 'ssmTmId' => $maxSe );
$qu_ssm2 = $ssm->qrySsm($con_ssm2);
if ($qu_ssm2->num_rows() > 0) {
$row_ssm = $qu_ssm2->row();
}
} // end Thai+Group
// ****************************** Thai+StudentYear ******************************
else {
$i = 0;
$con_rg = array('rgStdId' => $row_std->stdId);
$grp_rg = array('syId' => 'syId');
$rs_rg = $rg->qryRgJnSy($con_rg,'',$grp_rg);
foreach ($rs_rg->result() as $row_rg) {
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
//if($page == $max*2) {
if($page > $max) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$pdf->SetFont('AngsanaNew','B',12);
$pdf->SetY($y_axis);
$pdf->SetX($x_axis+17);
$pdf->Cell(57,5,iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_rg->syName) : th2a($row_rg->syName))),'LR',0,'L');
$pdf->Cell(13,5,'','R',0,'L');
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
$rs_rd2 = $rd->qryRdByStIdAndStY($row_std->stdId, $row_rg->rgSyId);
foreach ($rs_rd2->result() as $row_rd2) {
$tmp = explode('^', iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_rd2->crsName) : th2a($row_rd2->crsName))));
if(($i != $max) && (($i+count($tmp)) > $max)) {
for($b=0; $b<($max-$i); $b++) {
$pdf->SetFont('');
$pdf->SetY($y_axis);
$pdf->SetX($x_axis+17);
$pdf->Cell(57,5,'','LR',0,'L');
$pdf->Cell(13,5,'','R',0,'L');
$y_axis = $y_axis + $row_height;
}
$page = $page + ($max - $i);
$i = $i + ($max - $i);
}
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$tmp_y_axis = $y_axis;
$pdf->SetFont('');
$pdf->SetY($tmp_y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(17,5,iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_rd2->crsCode) : th2a($row_rd2->crsCode))),0,0,'L');
$pdf->CellFitScale(57,5,$tmp[0],'LR',0,'L');
//Go to next row
$tmp_y_axis = $tmp_y_axis + $row_height;
$cnt = 1;
if (isset($tmp[$cnt])) {
for ($cnt = 1; $cnt<count($tmp); $cnt++) {
$pdf->SetY($tmp_y_axis);
$pdf->SetX($x_axis+17);
$pdf->Cell(57,5,$tmp[$cnt],'LR',0,'L');
$pdf->Cell(13,5,'','R',0,'L');
//Go to next row
$tmp_y_axis = $tmp_y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis+17+57);
$pdf->Cell(13,5,iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_rd2->rdCreditAttempt) : th2a($row_rd2->rdCreditAttempt))),'R',0,'C');
$pdf->Cell(13,5,' '.iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? " ".a2th($row_rd2->rdGrade) : " ".th2a($row_rd2->rdGrade))),0,0,'L');// แสดงเกรดในตาราง CCC
//Go to next row
$y_axis = $y_axis + ($row_height * $cnt);
$i = $i + 1;
$page = $page + 1;
} //End while
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
if ($rd->getAllFDivisorAYRGPAXByStIdAndStY($row_std->stdId, $row_rd2->rgSyId)) {
$num_cal = number_format($rd->getDividendAYRGPAByStIdAndStY($row_std->stdId, $row_rd2->rgSyId)/$rd->getAllFDivisorAYRGPAXByStIdAndStY($row_std->stdId, $row_rd2->rgSyId), 2);
} else {
$num_cal = number_format(0,2);
}
$pdf->SetFont('AngsanaNew','B',12);
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(17,5,'',1,0,'C');
$pdf->Cell(44,5,'','LTB',0,'C');
$pdf->Cell(13,5,'รวม','RTB',0,'L');
$pdf->Cell(13,5,iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($rd->getAllFDivisorAYRGPAXByStIdAndStY($row_std->stdId, $row_rd2->rgSyId)) : th2a($rd->getAllFDivisorAYRGPAXByStIdAndStY($row_std->stdId, $row_rd2->rgSyId)))),1,0,'C');
$pdf->Cell(13,5,iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($num_cal) : th2a($num_cal))),1,0,'C');
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
} //End while
$maxAcY = $ssm->getMaxAcYByStdId($row_std->stdId);
$maxSe = $ssm->getMaxTmIdByStdIdAcY($row_std->stdId, $maxAcY);
$con_ssm2 = array('ssmStdId' => $row_std->stdId, 'ssmAcY' => $maxAcY, 'ssmTmId' => $maxSe );
$qu_ssm2 = $ssm->qrySsm($con_ssm2);
if ($qu_ssm2->num_rows() > 0) {
$row_ssm = $qu_ssm2->row();
}
} // end Thai+StudentYear
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->SetFont('AngsanaNew','B',12);
$pdf->Cell(75,5,'จำนวนหน่วยกิตตามหลักสูตร',0,0,'L');
$pdf->Cell(10,5,' '.iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_std->curMinCredit) : th2a($row_std->curMinCredit))),0,0,'L');
$pdf->Cell(15,5,'หน่วย',0,0,'L');
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(75,5,'จำนวนหน่วยกิตที่ลงทะเบียนเรียน',0,0,'L');
$pdf->Cell(10,5,' '.iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th((isset($row_ssm)?$row_ssm->ssmSumCreditAttempt:0)) : th2a((isset($row_ssm)?$row_ssm->ssmSumCreditAttempt:0)))),0,0,'L');
$pdf->Cell(15,5,'หน่วย',0,0,'L');
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(75,5,'คะแนนเฉลี่ยสะสมตลอดหลักสูตร',0,0,'L');
$pdf->Cell(25,5,' '.iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th(number_format((isset($row_ssm)?$row_ssm->ssmGPAX:0), 2)) : th2a(number_format((isset($row_ssm)?$row_ssm->ssmGPAX:0), 2)))),0,0,'L');
$y_axis = $y_axis + $row_height + $row_height;
$i = $i + 2;
$page = $page + 2;
// แสดงเมื่อสำเร็จการศึกษา
// if( $row_std->stdSstId ==3 || $row_std->stdSstId ==4 ) { // 20/2/2556
// up new column
$cntLineCP = 0;
$rs_ph = $ph->qryByCurIdAndAdYOrderSeq($row_std->stdCurId , $row_std->stdAdY);
//echo $ph->db->last_query();
foreach ($rs_ph->result() as $row_ph) {
$tmpCP = explode('^', $row_ph->cpName);
$cntLineCP += count($tmpCP);
}
if(($i+$cntLineCP+1) > $max) {
$i = $i + $cntLineCP + 1;
$page = $page + $cntLineCP + 1;
}
// end up new column
$cntShowLabTS = 0;
foreach ($rs_ph->result() as $row_ph) {
if($cntShowLabTS == 0) {
if($i >= $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page >= $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(100,5,'จำนวนชั่วโมงฝึกปฏิบัติการพยาบาล',0,0,'L');
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
}
$pdf->SetFont('');
$tmpCP = explode('^', iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_ph->cpName) : th2a($row_ph->cpName))));
if(($i+count($tmpCP)) > $max) {
$i = $i + count($tmpCP) - 1;
$page = $page + count($tmpCP) - 1;
}
$cntCP = 0;
foreach($tmpCP as $rr) {
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(78,5,$rr,0,0,'L');
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
$cntCP++;
}
$pdf->Cell(5,5,$row_ph->phLabHr ? ' '.iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th(number_format($row_ph->phLabHr)) : th2a(number_format($row_ph->phLabHr)))) : '',0,0,'R');
$pdf->Cell(2,5,'');
$pdf->Cell(15,5,$row_ph->phLabHr ? 'ชั่วโมง' : '',0,0,'L');
$cntShowLabTS = $cntShowLabTS + 1;
}
$chioce =array('E','G','P');
//if(in_array($row_std->stdExitExam,$chioce)){
$y_axis += 4;
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(82,5,'การทดสอบภาษาอังกฤษมาตรฐานของสถาบันพระบรมราชชนก',0,0,'L');
switch ($row_std->stdExitExam) {
case 'P':
$ExitExam = 'ผ่าน';
break;
case 'E':
$ExitExam = 'ดีเยี่ยม';
break;
case 'G':
$ExitExam = 'ดี';
break;
default:
$ExitExam = '';
}
//$pdf->Cell(15,6, $ExitExam ,0,0,'C');
$pdf->Cell(15,6, 'ผ่าน' ,0,0,'C');
//}
//if($row_std->CompsExam == 'P'){
$y_axis += 5;
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(79.5,5,'การสอบรวบยอดของสถาบันพระบรมราชชนก',0,0,'L');
$pdf->Cell(20,5,'ผ่าน',0,0,'C');
//}
// } // if($oSm->studentStatus==3 || $oSm->studentStatus==4)
} // end Thai
// ****************************** English ******************************
else if($typeLang=='E') {
//Picture
$pdf->SetY(2);
$pdf->SetX(180);
if($showStPic && $row_std->sdtPicturePath != '') {
$pdf->Cell(25,30,'',1,0,'C');
$pdf->Image($this->config->item('rg_pictureStd').$row_std->sdtPicturePath,181,3,23,28);
}
$page = 0;
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
// ****************************** English+Semester ******************************
if($typeDisplay == 'S') {
$i = 0;
$j = 0;
$con_ssm = array('ssmStdId' => $row_std->stdId);
$rs_ssm = $ssm->qrySsmJoinTm($con_ssm);
foreach ($rs_ssm->result() as $row_ssm) {
if(($i + 1) >= $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
//if($page == $max*2) {
if($page > $max) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
if($lineSpacingEng == 4)
$pdf->SetFont('AngsanaNew','B',12);
else
$pdf->SetFont('AngsanaNew','B',13);
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(100,$row_height,intval($row_ssm->ssmAcY-543).' '.$row_ssm->tmNameE,0,0,'C');
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
$rs_rd = $rd->getRegistDetailsByStdIdAcYTmId($row_std->stdId,$row_ssm->ssmAcY,$row_ssm->tmId);
foreach ($rs_rd->result() as $row_rd) {
$tmp = explode('^', $row_rd->crsNameE);
if(($i != $max) && (($i+count($tmp)) > $max)) {
$page = $page + ($max - $i);
$i = $i + ($max - $i);
}
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$tmp_y_axis = $y_axis;
$pdf->SetFont('');
$pdf->SetY($tmp_y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(15,$row_height,$row_rd->crsCodeE,0,0,'L');
$pdf->CellFitScale(69,$row_height,$tmp[0],0,0,'L');
//Go to next row
$tmp_y_axis = $tmp_y_axis + $row_height;
$cnt = 1;
if (isset($tmp[$cnt])) {
for ($cnt = 1; $cnt<count($tmp); $cnt++) {
$pdf->SetY($tmp_y_axis);
$pdf->SetX($x_axis+17);
$pdf->Cell(57,5,$tmp[$cnt],0,0,'L');
//Go to next row
$tmp_y_axis = $tmp_y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis+15+69);
$pdf->Cell(8,$row_height,$row_rd->rdCreditAttempt,0,0,'C');
$pdf->Cell(8,$row_height,' '.$row_rd->rdGrade,0,0,'L'); // อังกฤษ / รายภาคการศึกษา
//Go to next row
$y_axis = $y_axis + ($row_height * $cnt);
$i = $i + 1;
$page = $page + 1;
} //End while
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
if($lineSpacingEng == 4)
$pdf->SetFont('AngsanaNew','B',12);
else
$pdf->SetFont('AngsanaNew','B',13);
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
if($j == 0)
$pdf->Cell(100,$row_height,'SEM-CR.: '.$row_ssm->ssmCreditPoint.' SEM-G.P.A.: '.number_format($row_ssm->ssmGPA, 2),0,0,'C');
else
$pdf->Cell(100,$row_height,'SEM-CR.: '.$row_ssm->ssmCreditPoint.' SEM-G.P.A.: '.number_format($row_ssm->ssmGPA, 2).' CUM-CR.: '.$row_ssm->ssmSumCreditPoint.' CUM-G.P.A.: '.number_format($row_ssm->ssmGPAX, 2),0,0,'C');
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
$j = $j + 1;
} //End while
} // end English+Semester
// ****************************** English+Group ******************************
else if($typeDisplay == 'G') {
$i = 0;
//$j = 0;
$rs_cs = $cs->qryCsCdId1ByCsCurId($row_std->stdCurId);
foreach ($rs_cs->result() as $row_cs) {
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
//if($page == $max*2) {
if($page > $max) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
if($lineSpacingEng == 4)
$pdf->SetFont('AngsanaNew','B',12);
else
$pdf->SetFont('AngsanaNew','B',13);
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(100,$row_height,$row_cs->cdNameE,0,0,'C');
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
$con_rd = array('rdStdId' => $row_std->stdId, 'rdCdId1' => $row_cs->csCdId1);
$ord_rd = array('coId' => '');
$rs_rd = $rd->qryRdJnCrsOpCrs($con_rd,$ord_rd);
foreach ($rs_rd->result() as $row_rd) {
$tmp = explode('^', $row_rd->crsNameE);
if(($i != $max) && (($i+count($tmp)) > $max)) {
$page = $page + ($max - $i);
$i = $i + ($max - $i);
}
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$tmp_y_axis = $y_axis;
$pdf->SetFont('');
$pdf->SetY($tmp_y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(15,$row_height,$row_rd->crsCodeE,0,0,'L');
$pdf->CellFitScale(69,$row_height,$tmp[0],0,0,'L');
//Go to next row
$tmp_y_axis = $tmp_y_axis + $row_height;
$cnt = 1;
if (isset($tmp[$cnt])) {
for ($cnt = 1; $cnt<count($tmp); $cnt++) {
$pdf->SetY($tmp_y_axis);
$pdf->SetX($x_axis+15);
$pdf->Cell(69,$row_height,$tmp[$cnt],0,0,'L');
//Go to next row
$tmp_y_axis = $tmp_y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis+15+69);
$pdf->Cell(8,$row_height,$row_rd->rdCreditAttempt,0,0,'C');
$pdf->Cell(8,$row_height,' '.$row_rd->rdGrade,0,0,'L'); // อังกฤษ / รายหมวดวิชา
//Go to next row
$y_axis = $y_axis + ($row_height * $cnt);
$i = $i + 1;
$page = $page + 1;
} //End while
} //End while
$maxAcY = $ssm->getMaxAcYByStdId($row_std->stdId);
$maxSe = $ssm->getMaxTmIdByStdIdAcY($row_std->stdId, $maxAcY);
$con_ssm2 = array('ssmStdId' => $row_std->stdId, 'ssmAcY' => $maxAcY, 'ssmTmId' => $maxSe );
$qu_ssm2 = $ssm->qrySsm($con_ssm2);
if ($qu_ssm2->num_rows() > 0) {
$row_ssm = $qu_ssm2->row();
}
} // end English+Group
// ****************************** English+StudentYear ******************************
else {
$i = 0;
$con_rg = array('rgStdId' => $row_std->stdId);
$grp_rg = array('syId' => 'syId');
$rs_rg = $rg->qryRgJnSy($con_rg,'',$grp_rg);
foreach ($rs_rg->result() as $row_rg) {
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
//if($page == $max*2) {
if($page > $max) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
if($lineSpacingEng == 4)
$pdf->SetFont('AngsanaNew','B',12);
else
$pdf->SetFont('AngsanaNew','B',13);
$pdf->SetY($y_axis);
$pdf->SetX($x_axis+15);
$pdf->Cell(69,$row_height,$row_rg->syNameE,'LR',0,'L');
$pdf->Cell(8,$row_height,'','R',0,'L');
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
$rs_rd2 = $rd->qryRdByStIdAndStY($row_std->stdId, $row_rg->rgSyId);
foreach ($rs_rd2->result() as $row_rd2) {
$tmp = explode('^', $row_rd2->crsNameE);
if(($i != $max) && (($i+count($tmp)) > $max)) {
for($b=0; $b<($max-$i); $b++) {
$pdf->SetFont('');
$pdf->SetY($y_axis);
$pdf->SetX($x_axis+15);
$pdf->Cell(69,$row_height,'',0,0,'L');
$pdf->Cell(8,$row_height,'',0,0,'L');
$y_axis = $y_axis + $row_height;
}
$page = $page + ($max - $i);
$i = $i + ($max - $i);
}
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$tmp_y_axis = $y_axis;
$pdf->SetFont('');
$pdf->SetY($tmp_y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(15,$row_height,$row_rd2->crsCodeE,0,0,'L');
$pdf->CellFitScale(69,$row_height,$tmp[0],'LR',0,'L');
//Go to next row
$tmp_y_axis = $tmp_y_axis + $row_height;
$cnt = 1;
if (isset($tmp[$cnt])) {
for ($cnt = 1; $cnt<count($tmp); $cnt++) {
$pdf->SetY($tmp_y_axis);
$pdf->SetX($x_axis+15);
$pdf->Cell(69,$row_height,$tmp[$cnt],'LR',0,'L');
$pdf->Cell(8,$row_height,'','R',0,'L');
//Go to next row
$tmp_y_axis = $tmp_y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis+15+69);
$pdf->Cell(8,$row_height,$row_rd2->rdCreditAttempt,'R',0,'C');
$pdf->Cell(8,$row_height,' '.$row_rd2->rdGrade,0,0,'L'); // อังกฤษ / รายชั้นปี
//Go to next row
$y_axis = $y_axis + ($row_height * $cnt);
$i = $i + 1;
$page = $page + 1;
} //End while
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
if ($rd->getAllFDivisorAYRGPAXByStIdAndStY($row_std->stdId, $row_rd2->rgSyId)) {
$num_cal = number_format($rd->getDividendAYRGPAByStIdAndStY($row_std->stdId, $row_rd2->rgSyId)/$rd->getAllFDivisorAYRGPAXByStIdAndStY($row_std->stdId, $row_rd2->rgSyId), 2);
} else {
$num_cal = number_format(0,2);
}
if($lineSpacingEng == 4)
$pdf->SetFont('AngsanaNew','B',12);
else
$pdf->SetFont('AngsanaNew','B',13);
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(15,$row_height,'',1,0,'C');
$pdf->Cell(56,$row_height,'','LTB',0,'C');
$pdf->Cell(13,$row_height,'Total','RTB',0,'L');
$pdf->Cell(8,$row_height,$rd->getAllFDivisorAYRGPAXByStIdAndStY($row_std->stdId, $row_rd2->rgSyId),1,0,'C');
$pdf->Cell(8,$row_height,$num_cal,1,0,'C');
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
} //End while
$maxAcY = $ssm->getMaxAcYByStdId($row_std->stdId);
$maxSe = $ssm->getMaxTmIdByStdIdAcY($row_std->stdId, $maxAcY);
$con_ssm2 = array('ssmStdId' => $row_std->stdId, 'ssmAcY' => $maxAcY, 'ssmTmId' => $maxSe );
$qu_ssm2 = $ssm->qrySsm($con_ssm2);
if ($qu_ssm2->num_rows() > 0) {
$row_ssm = $qu_ssm2->row();
}
} // end English+StudentYear
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
if($lineSpacingEng == 4)
$pdf->SetFont('AngsanaNew','B',12);
else
$pdf->SetFont('AngsanaNew','B',13);
$pdf->Cell(75,5,'Total Credit Earned',0,0,'L');
$pdf->Cell(10,5,' '.$row_std->curMinCredit,0,0,'L');
$pdf->Cell(15,5,'Credits',0,0,'L');
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(75,5,'Total Credit Registered',0,0,'L');
$pdf->Cell(10,5,' '.(isset($row_ssm)?$row_ssm->ssmSumCreditAttempt:0),0,0,'L');
$pdf->Cell(15,5,'Credits',0,0,'L');
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(75,5,'Total Grade Point Average',0,0,'L');
$pdf->Cell(25,5,' '.number_format((isset($row_ssm)?$row_ssm->ssmGPAX:0), 2),0,0,'L');
$y_axis = $y_axis + $row_height + $row_height;
$i = $i + 2;
$page = $page + 2;
// แสดงเมื่อสำเร็จการศึกษา
// if($row_std->stdSstId ==3 || $row_std->stdSstId ==4 ) { // 20/2/2556
// up new column
$cntLineCP = 0;
$rs_ph = $ph->qryByCurIdAndAdYOrderSeq($row_std->stdCurId , $row_std->stdAdY);
foreach ($rs_ph->result() as $row_ph) {
$tmpCP = explode('^', $row_ph->cpNameE);
$cntLineCP += count($tmpCP);
}
if(($i+$cntLineCP+1) > $max) {
$i = $i + $cntLineCP + 1;
$page = $page + $cntLineCP + 1;
}
// end up new column
$cntShowLabTS = 0;
foreach ($rs_ph->result() as $row_ph) {
if($cntShowLabTS == 0) {
if($i >= $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page >= $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(100,5,'Certified Practicum Hours',0,0,'L');
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
}
$pdf->SetFont('');
$tmpCP = explode('^', $row_ph->cpNameE);
if(($i+count($tmpCP)) > $max) {
$i = $i + count($tmpCP) - 1;
$page = $page + count($tmpCP) - 1;
}
$cntCP = 0;
foreach($tmpCP as $rr) {
if($i == $max) {
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial + 100;
$i = 0;
if($page == $max*2) {
$page = 0;
$pdf->AddPage();
$y_axis = $y_axis_initial + $row_height;
$x_axis = $x_axis_initial;
}
}
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(78,5,$rr,0,0,'L');
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
$cntCP++;
}
$pdf->Cell(5,5,$row_ph->phLabHr ? ' '.number_format($row_ph->phLabHr) : '',0,0,'R');
$pdf->Cell(2,'');
$pdf->Cell(15,5,$row_ph->phLabHr ? 'Hours' : '',0,0,'L');
$cntShowLabTS = $cntShowLabTS + 1;
}
$chioce =array('E','G','P');
//if(in_array($row_std->stdExitExam,$chioce)){
$y_axis += 4;
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(85,5,'Praboromarajchanok Institute English Test',0,0,'L');
switch ($row_std->stdExitExam) {
case 'P':
$ExitExam = 'P';
break;
case 'E':
$ExitExam = 'Excellent';
break;
case 'G':
$ExitExam = 'Good';
break;
default:
$ExitExam = '';
}
$pdf->Cell(15,5,'P',0,0,'L');
//}
/* if($row_std->CompsExam == 'P'){ */
$y_axis += 5;
$pdf->SetY($y_axis);
$pdf->SetX($x_axis);
$pdf->Cell(77,5,'Comprehensive Examination',0,0,'L');
$pdf->Cell(20,5,'P',0,0,'C');
/* } */
// } // if($oSm->studentStatus==3 || $oSm->studentStatus==4)
} // end English
$cntSt++;
}
}
else {
?>
<table align="center">
<tr>
<td align="center"><font face="Microsoft Sans Serif" color="<?php echo $GLOBALS["COLOR_FONT_6"];?>" size="2">** ไม่ปรากฏข้อมูล **<br>
<a href="#" onClick="window.close()">[ปิดหน้านี้]</a></font></td>
</tr>
</table>
<?php
}
} // end TypeSt
$pdf->Output();
set_time_limit(30);
?>
<meta http-equiv="refresh" content="0; URL=<?php echo base_url().$this->config->item('rg_docPdf');?>">
<?php
}else {
?>
<meta http-equiv="Content-Type" content="text/html; charset=TIS-620" />
<table align="center">
<tr>
<td align="center"><font face="Microsoft Sans Serif" >** ไม่ปรากฏข้อมูล **<br>
<?php echo anchor($this->config->item("rg_folder")."rpt_misc/searchRptRis125","[ปิดหน้านี้]");?>
</font></td>
</tr>
</table>
<?php
}
?>
|