Viewing file:      v_rptRis107.php (5.39 KB)      -rwxr-xr-x Select action/file-type:    (+) |   (+) |   (+) | Code (+) | Session (+) |   (+) | SDB (+) |   (+) |   (+) |   (+) |   (+) |   (+) |
 
<?php
 define('FPDF_FONTPATH',$this->config->item('path_application').'/font/');
 
 class PDF extends FPDF {
     var $cfgClgLogo;
     var $cfgClgName;
     var $cfgSiteName;
 
     //Page header
     function Header() {
         //Logo
         $this->Image($this->cfgClgLogo,10,3,18,15);
         //AngsanaNew bold 15
         $this->SetFont('AngsanaNew','B',15);
         //Move to the right
         $this->SetY(7);
         $this->SetX(30);
         //Title
         $this->Cell(0,0,$this->cfgClgName,0,0,'L');
         $this->SetX(-10);
         $this->SetFontSize(12);
         $this->Cell(0,0,'RIS107',0,0,'R');
         $this->Ln(7);
         $this->SetX(30);
         $this->SetFontSize(15);
         $this->Cell(0,0,$this->cfgSiteName,0,0,'L');
         //Draw line
         $this->SetLineWidth(0.4);
         $this->Line(10,19,200,19);
     }
 
     //Page footer
     function Footer() {
         //Draw line
         $this->SetLineWidth(0.4);
         $this->Line(10,286,200,286);
         $this->SetY(-7);
         $this->SetFont('AngsanaNew','',14);
         //Page number
         $this->Cell(0,0,'หน้า '.$this->PageNo().'/{nb}',0,0,'R');
         $this->SetY(-7);
         $this->Cell(0,0,'วันที่พิมพ์ : '.date("d/m/y H:i"),0,0,'L');
     }
 
     var $angle=0;
     function Rotate($angle,$x=-1,$y=-1)
     {
         if($x==-1)
             $x=$this->x;
         if($y==-1)
             $y=$this->y;
         if($this->angle!=0)
             $this->_out('Q');
         $this->angle=$angle;
         if($angle!=0)
         {
             $angle*=M_PI/180;
             $c=cos($angle);
             $s=sin($angle);
             $cx=$x*$this->k;
             $cy=($this->h-$y)*$this->k;
             $this->_out(sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm',$c,$s,-$s,$c,$cx,$cy,-$cx,-$cy));
         }
     }
     
     function RotatedText($x,$y,$txt,$angle)
     {
         //Text rotated around its origin
         $this->Rotate($angle,$x,$y);
         $this->Text($x,$y,$txt);
         $this->Rotate(0);
     }
 
 } //End class
 
 //Create new pdf file
 $pdf=new PDF();
 $pdf->cfgClgLogo = $this->config->item('rg_upload_picture').$cfgClgLogo;
 $pdf->cfgClgName = iconv('UTF-8','TIS-620',$cfgClgName);
 $pdf->cfgSiteName = iconv('UTF-8','TIS-620',$cfgSiteName);
 
 //Set thai font
 $pdf->SetThaiFont();
 
 $pdf->AliasNbPages();
 
 //Open file
 $pdf->Open();
 
 //Disable automatic page break
 $pdf->SetAutoPageBreak(false);
 
 //Set initial y axis position per page
 $y_axis_initial = 65;
 
 //Set Row Height
 $row_height = 6;
 
 //Add first page
 $pdf->AddPage();
 
 if($qu_std->num_rows()) {
     $row = $qu_std->row();
 
     //Title
     $pdf->SetY(30);
     $pdf->SetFont('AngsanaNew','B',18);
     $pdf->Cell(0,0,'ใบเพิ่ม/ถอนรายวิชา',0,0,'C');
     $pdf->Ln(7);
     $pdf->SetFont('AngsanaNew','',16);
     $pdf->Cell(0,0,'ภาคการศึกษาที่     '.$tmId.'      ปีการศึกษา     '.$acY,0,0,'C');
     $pdf->Ln(7);
     $pdf->Cell(0,0,'รหัสนักศึกษา     '.$row->stdCode.'      ชื่อ-สกุลนักศึกษา     '.iconv('UTF-8','TIS-620',$row->prefixName).iconv('UTF-8','TIS-620',$row->stdName).' '.iconv('UTF-8','TIS-620',$row->stdSurname).'      ชั้นปี     '.iconv('UTF-8','TIS-620',$row->stdSyId),0,0,'C');
     $pdf->Ln(7);
     $pdf->Cell(0,0,'หลักสูตร     '.iconv('UTF-8','TIS-620',$row->curName),0,0,'C');
     $pdf->Ln(7);
 
 // table rg_Adviser
     if(isset($rs_adv) && $rs_adv->num_rows()) {
         $prsNames = $rs_adv->row()->prsNames;
         if($prsNames!=NULL) {
             $name = $rs_adv->row()->prsNames;
         } else {
             $name = "-";
         }
     } else {
         $name = "-";
     }
     
     $pdf->Cell(0,0,'อาจารย์ที่ปรึกษา     '.iconv('UTF-8','TIS-620', $name),0,0,'L');
 
     //print column titles for the actual page    
     $pdf->SetFillColor(232,232,232);
     $pdf->SetFontSize(14);
     $pdf->SetY($y_axis_initial);
     $pdf->SetX(25);
     $pdf->Cell(15,12,'รหัสวิชา',1,0,'C',1);
     $pdf->Cell(60,12,'ชื่อรายวิชา',1,0,'C',1);
     $pdf->Cell(20,6,'หน่วยกิต','LRT',0,'C',1);
     $pdf->Cell(40,6,'อาจารย์ผู้รับผิดชอบ','LRT',0,'C',1);
     $pdf->Cell(40,12,'วันเวลาที่เรียน',1,0,'C',1);
 
     $y_axis = $y_axis_initial + $row_height;
 
     $pdf->SetY($y_axis);
     $pdf->SetX(100);
     $pdf->Cell(20,6,'(ชั่วโมง)','LRB',0,'C',1);
     $pdf->Cell(40,6,'รายวิชาลงนาม','LRB',0,'C',1);
 
     $y_axis = $y_axis + $row_height;
 
     $i = 0;
     while($i < 10) {
         $pdf->SetFont('AngsanaNew','',14);
         if($i == 3) {
             $pdf->Rect(10,$y_axis-18,12,28);
             $pdf->RotatedText(17,$y_axis,'เพิ่ม',90);
         }
         if($i == 8) {
             $pdf->Rect(10,$y_axis-18,12,28);    
             $pdf->RotatedText(17,$y_axis,'ถอน',90);
         }
         
         $pdf->SetY($y_axis);
         $pdf->SetX(25);
         $pdf->Cell(15,6,'',1,0,'L');
         $pdf->Cell(60,6,'',1,0,'L');
         $pdf->Cell(20,6,'',1,0,'L');
         $pdf->Cell(40,6,'',1,0,'L');
         $pdf->Cell(40,6,'',1,0,'L');        
         
         //Go to next row
         $y_axis = $y_axis + $row_height;
         $i++;
     } //End while
 
     $pdf->SetY($y_axis);
     $pdf->SetX(25);
     $pdf->Cell(75,6,'จำนวนหน่วยกิตก่อนเพิ่ม/ถอน',0,0,'C');
     $pdf->Cell(20,6,'',1,0,'L');
 
     $y_axis = $y_axis + $row_height;
 
     $pdf->SetY($y_axis);
     $pdf->SetX(25);
     $pdf->Cell(75,6,'เพิ่ม/ถอนแล้วคงเหลือ',0,0,'C');
     $pdf->Cell(20,6,'',1,0,'L');
 
     $y_axis = $y_axis + $row_height + $row_height;
 
     $pdf->SetY($y_axis);
     $pdf->SetX(25);
     $pdf->Cell(0,6,'ลายมือชื่อนักศึกษา........................................',0,0,'L');
     $pdf->Ln(7);
     $pdf->SetX(25);
     $pdf->Cell(0,6,'วันที่........................................',0,0,'L');
     $pdf->Ln(14);
     $pdf->SetX(25);
     $pdf->Cell(0,6,'ลายมือชื่ออาจารย์ที่ปรึกษา........................................',0,0,'L');
     $pdf->Ln(7);
     $pdf->SetX(25);
     $pdf->Cell(0,6,'วันที่........................................',0,0,'L');
 
     //Create file
         
         $pdf->Output();
     
     } //End if($rs_std->num_rows())
     else{
         $pdf->SetFont('AngsanaNew','B',18);
         $pdf->SetY(27);
         $pdf->Cell(0,0,'ไม่มีข้อมูล...',0,0,'C');
         $pdf->Output();
     }
     
     $pdf->Output();
 ?>
  |