Viewing file: v_rptRis125_origin.php (59.49 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 $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 $qu_pp;
var $pp_name;
var $pp_nameE;
//Page header
function Header() {
$row_std = $this->qu_std->row();
$row_ac = $this->qu_ac->row();
//print_r($row_std); exit;
$birthDate = ($row_std->sdtBirthDate=='0000-00-00') ? '-' : fullDate(splitDateDb2($row_std->sdtBirthDate));
$birthDateE = ($row_std->sdtBirthDate=='0000-00-00') ? '-' : fullDateEng(splitDateDb2($row_std->sdtBirthDate));
//Logo
if($this->showCfgClgLogo)
$this->Image($this->cfgClgLogo,15,2,15,25);
if($this->lang == 'T1' || $this->lang == 'T2') {
if ($this->honorMedal == 'H') {
eval("\$str = 'acHonor".$row_std->stdHonor."';");
if ($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(2);
$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->cfgClgName) : th2a($this->cfgClgName)),0,0,'C');
$this->Ln(6);
$this->Cell(0,6,(($this->lang == 'T2') ? a2th($this->cfgInstitute) : th2a($this->cfgInstitute)),0,0,'C');
$this->Ln(6);
$this->Cell(0,6,(($this->lang == 'T2') ? a2th($this->cfgMinistry) : th2a($this->cfgMinistry)),0,0,'C');
$tmpEdg = explode('^',$row_std->sdtEdgName);
if($this->affiliatedTo || count($tmpEdg) >= 2){
$this->SetY(27);
}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($birthDate) : th2a($birthDate))),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(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->SetFont('AngsanaNew','B',16);
$this->Cell(0,6,$this->cfgClgNameE,0,0,'C');
$this->Ln(6);
$this->Cell(0,6,$this->cfgInstituteE,0,0,'C');
$this->Ln(6);
$this->Cell(0,6,$this->cfgMinistryE,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,$birthDateE,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->SetFont('AngsanaNew','B');
$this->Cell(13.5,5,'Religion: ',0,0,'L');
if(!$this->affiliatedTo){
$this->SetFont('');
$this->Cell(72.5,5,$row_std->religionNameEng,0,0,'L');
if(count($tmpEdg) >= 2){
$this->Cell(0,5,$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()
{
$row_std = $this->qu_std->row();
if($this->typePaper == 'A4')
$y_axis = 263;
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
$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');
}
}
}
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;
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();
//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 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; //93
}
}
// ****************************** TypeSt ******************************
if($typeSt=='Y' && $qu_std->num_rows()) {
// find student
if($qu_std->num_rows()) {
$row_std = $qu_std->row();
$pdf->studentId = $row_std->stdId;
$pdf->AddPage();
// ****************************** Thai ******************************
if($typeLang=='T1' || $typeLang == 'T2') {
//Picture
$pdf->SetY(2);
$pdf->SetX(180);
if($showStPic) {
$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',(($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,'L');
//$pdf->Cell(57,5,$tmp[0],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(13,5,iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_rd->rdCreditAttempt) : th2a($row_rd->rdCreditAttempt))),0,0,'C');
$pdf->Cell(13,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
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))).' ÿÿ?ÿÿÿÿÿÿÿÿÿ: '.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,'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(13,5,iconv('UTF-8','TIS-620',(($typeLang == 'T2') ? a2th($row_rd->rdCreditAttempt) : th2a($row_rd->rdCreditAttempt))),0,0,'C');
$pdf->Cell(13,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');
//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(75,5,$rr,0,0,'L');
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
$cntCP++;
}
$pdf->Cell(10,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,'L');
$pdf->Cell(15,5,$row_ph->phLabHr ? 'ÿÿÿÿÿÿÿ' : '',0,0,'L');
$cntShowLabTS = $cntShowLabTS + 1;
}
// } // if($oSm->studentStatus==3 || $oSm->studentStatus==4)
} // end Thai
// ****************************** English ******************************
else if($typeLang=='E') {
//Picture
$pdf->SetY(2);
$pdf->SetX(180);
if($showStPic) {
$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(75,5,$rr,0,0,'L');
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
$page = $page + 1;
$cntCP++;
}
$pdf->Cell(10,5,$row_ph->phLabHr ? ': '.number_format($row_ph->phLabHr) : '',0,0,'L');
$pdf->Cell(15,5,$row_ph->phLabHr ? 'Hours' : '',0,0,'L');
$cntShowLabTS = $cntShowLabTS + 1;
}
// } // if($oSm->studentStatus==3 || $oSm->studentStatus==4)
} // end English
//Create file
$pdf->Output();
}
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_student/searchRptRis125","[ÿ??ÿ?ÿÿ]");?>
</font></td>
</tr>
</table>
<?php
}
} // end TypeSt
$pdf->Output();
}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_student/searchRptRis125","[ÿ??ÿ?ÿÿ]");?>
</font></td>
</tr>
</table>
<?php
}
?>
|