Viewing file:      v_rptRis106PDF_.php (13.74 KB)      -rwxr-xr-x Select action/file-type:    (+) |   (+) |   (+) | Code (+) | Session (+) |   (+) | SDB (+) |   (+) |   (+) |   (+) |   (+) |   (+) |
 
<?php
 $refNo = '';
 if ($row = $qu_std->row()){
     $stdCode = iconv('UTF-8','CP874',$row->stdCode);
     $stdName = iconv('UTF-8','CP874',$row->prefixName.$row->stdName.' '.$row->stdSurname);
     $stdAdY = $row->stdAdY;
 }
 
  if($qu_cur->num_rows()) { 
      $row = $qu_cur->row(); 
      $course = iconv('UTF-8','CP874',$row->curName); 
 }
 
 if($qu_reg->num_rows()) { 
     $row = $qu_reg->row(); 
     $refNo = $row->rfRefNo; 
 }
 $datepay = '';
 if($qu_sd->num_rows()) { 
     $row = $qu_sd->row();  
     $datepay = iconv('UTF-8','CP874',fullDate(splitDateDb2($row->sdPaySDate)).' - '.fullDate(splitDateDb2($row->sdPayEDate))); 
 }
 
 define('FPDF_FONTPATH',$this->config->item('path_application').'/font/');
 $this->load->library('PDF_Code128');
 
 class PDF extends FPDF
 {
 
     //Page header
     function Header()
     {
     }
 
     //Page footer
     function Footer()
     {
     }
 
 } //End class
 
 $place = iconv('UTF-8','CP874',$cfgClgName);
 $clg_name_bank = iconv('UTF-8','CP874',$cfgClgBankName);
 $name_bookbank = iconv('UTF-8','CP874',$cfgClgBankNo);
 $comcode = '';
 //Create new pdf file
 $pdf=new PDF_Code128();
 
 //Set thai font
 $pdf->AddFont('AngsanaNew','','cordia.php');
 $pdf->AddFont('AngsanaNew','B','cordiab.php');
 
 $pdf->AliasNbPages();
 
 //Open file
 $pdf->Open();
 
 //Disable automatic page break
 $pdf->SetAutoPageBreak(false);
 
 //Add first page
 
 $pdf->AddPage();
 
 //initialize counter
 $i = 0;
 $r = 1;
 
 $pdf->SetRightMargin(17);
 
 //$pdf->SetFont('Arial','',50);
 //$pdf->SetTextColor(190,190,190);
 //$pdf->RotatedText(40,160,'Example Payment',45);
 //$pdf->RotatedText(100,270,'Example Payment',45);
 
 $pdf->SetTextColor(0,0,0);
 $pdf->SetXY(20,15);
 $pdf->image(base_url().$this->config->item('rg_upload_picture').$cfgClgLogo,18,10,20);
 
 $pdf->SetFont('AngsanaNew','B',14);
 $pdf->SetXY(170,15);
 $pdf->Cell(0,0,'(ส่วนสำหรับนักศึกษา)',0,0,'R');
 $pdf->SetFont('AngsanaNew','B',20);
 $pdf->SetXY(37,15);
 $pdf->Cell(40,0,$place,0,0,'');
 $pdf->setXY(37,21);
 $pdf->SetFont('AngsanaNew','B',16);
 $pdf->Cell(0,0,'ใบลงทะเบียนเรียน / แจ้งค่าใช้จ่าย',0,0);
 $pdf->SetFont('AngsanaNew','B',16);
 $pdf->Cell(0,0,'ประจำปีการศึกษาที่ '.$acY.' ภาคการศึกษาที่ '.$tmId,0,0,'R');
 $pdf->setXY(37,26);
 $pdf->SetFont('AngsanaNew','',12);
 $pdf->Cell(0,0,'Statement of Applicant Account / Receipt',0,0);
 $pdf->Cell(0,0,'วันที่พิมพ์ใบชำระเงิน: '.iconv('UTF-8','CP874',fullDate2(date('Y-m-d'))),0,0,'R');
 
 $pdf->SetFont('AngsanaNew','B',12);
 $pdf->setXY(20,35);
 $pdf->Cell(0,0,'รหัสนักศึกษา',0,0);
 $pdf->setXY(50,35);
 $pdf->Cell(0,0,$stdCode,0,0);
 $pdf->setXY(20,40);
 $pdf->Cell(0,0,'ชื่อ - สกุล',0,0);
 $pdf->setXY(50,40);
 $pdf->Cell(0,0,$stdName,0,0);
 $pdf->setXY(20,45);
 $pdf->Cell(0,0,'หลักสูตร',0,0);
 $pdf->setXY(50,45);
 $pdf->Cell(0,0,$course,0,0);
 
 $pdf->setXY(20,35);
 $pdf->Cell(0,0,'เลขที่ลงทะเบียน '.$refNo,0,0,'R');
 //$pdf->setXY(20,42);
 //$pdf->Cell(0,0,'วันที่สมัคร: '.iconv('UTF-8','CP874',dateThai($app_date_start)),0,0,'R');
 //$pdf->setXY(20,47);
 //$pdf->Cell(0,0,'สถานที่ศึกษา'.' '.$place,0,0,'R');
 
 
 $pdf->SetFont('AngsanaNew','B',12);
 $pdf->setXY(6,50);
 $pdf->Cell(10,6,'ที่',1,1,'C');
 $pdf->setXY(16,50);
 $pdf->Cell(108,6,'รายการ',1,1,'C');
 $pdf->setXY(124,50);
 $pdf->Cell(25,6,'หน่วยกิต',1,1,'C');
 $pdf->setXY(149,50);
 $pdf->Cell(25,6,'รวมเงิน',1,1,'C');
 $pdf->setXY(174,50);
 $pdf->Cell(30,6,'หมายเหตุ',1,1,'C');
 
 //set initial y axis position per page
 $y_axis_initial = 50;
 
 //set initial x axis position of table
 $x_axis_initial = 6;
 
 //Set Row Height
 $row_height = 6;
 
 $pdf->SetFont('AngsanaNew','',11);
 $i = 0;
 $y = 63;
 $head = 1;
 $num = 0;
 $fn_s = 14;
 //print column titles for the actual page
 $b = 1;
 $y_axis = $y_axis_initial + $row_height;
 
 if ($stdAdY < $this->config->item('reviseY')) {
 
     if ($rs_cmf->num_rows() + $rs_cf->num_rows() ) {
         $fn_s = 10;
         $row_height = 4;
     } else {
         $fn_s = 14;
     }
 
     $pdf->SetFont('AngsanaNew','',$fn_s);
     $pdf->SetY($y_axis);
     $pdf->SetX($x_axis_initial);
     $pdf->Cell(10,6,$b,0,0,'C');
     $pdf->Cell(108,6,'ค่าหน่วยกิต',0,0,'L');
     $pdf->Cell(25,6,'',0,0,'C');
     $pdf->Cell(25,6,'',0,0,'R');
     $pdf->Cell(30,6,'เบิกได้ตามสิทธิ์',0,0,'L');
 
     $y_axis = $y_axis + $row_height;
     
     $b ++;
     //initialize counter
     $i = 2;
 
     foreach($rs_rgd->result() as $row) {
 
         $pdf->SetFont('AngsanaNew','',$fn_s);
         $pdf->SetY($y_axis);
         $pdf->SetX($x_axis_initial);
         $pdf->Cell(10,6,'',0,0,'C');
         $pdf->Cell(108,6,iconv('UTF-8','CP874',$row->crsCode.' : '.$row->crsName),0,0,'L');
         $pdf->Cell(25,6,$row->crsUnit,0,0,'C');
         $pdf->Cell(25,6,'-',0,0,'R');
         $pdf->Cell(30,6,'',0,0,'L');
 
         //Go to next row
         $y_axis = $y_axis + $row_height;
         $i = $i + 1;
     } //End while
 
     $pdf->SetFont('AngsanaNew','B',$fn_s);
     $pdf->SetY($y_axis);
     $pdf->SetX($x_axis_initial);
     $pdf->Cell(10,6,'',0,0,'C');
     $pdf->Cell(108,6,'รวมหน่วยกิตทฤษฎี',0,0,'R');
     $pdf->Cell(25,6,number_format($sumRdCredit1),0,0,'C');
     $pdf->Cell(25,6,number_format($sumLcFee, 2),0,0,'R');
     $pdf->Cell(30,6,'',0,0,'L');
 
     $y_axis = $y_axis + $row_height;
 
     $pdf->SetY($y_axis);
     $pdf->SetX($x_axis_initial);
     $pdf->Cell(10,6,'',0,0,'C');
     $pdf->Cell(108,6,'รวมหน่วยกิตทดลอง/ปฏิบัติ',0,0,'R');
     $pdf->Cell(25,6,number_format($sumRdCredit2),0,0,'C');
     $pdf->Cell(25,6,number_format($sumLbFee, 2),0,0,'R');
     $pdf->Cell(30,6,'',0,0,'L');
 
     $y_axis = $y_axis + $row_height;
 
     $pdf->SetY($y_axis);
     $pdf->SetX($x_axis_initial);
     $pdf->Cell(10,6,'',0,0,'C');
     $pdf->Cell(108,6,'รวมหน่วยกิตที่ลงทะเบียน',0,0,'R');
     $pdf->Cell(25,6,number_format($sumRdCreditAttempt),0,0,'C');
     $pdf->Cell(25,6,number_format($sumLcFee+$sumLbFee, 2),0,0,'R');
     $pdf->Cell(30,6,'',0,0,'L');
     $y_axis = $y_axis + $row_height;
 
 } else {
     if ($sumLcFee+$sumLbFee) {
         $pdf->SetFont('AngsanaNew','',$fn_s);
         $pdf->SetY($y_axis);
         $pdf->SetX($x_axis_initial);
         $pdf->Cell(10,6,$b,0,0,'C');
         $pdf->Cell(108,6,'ค่าหน่วยกิตเหมาจ่าย',0,0,'L');
         $pdf->Cell(25,6,number_format($sumRdCreditAttempt),0,0,'C');
         $pdf->Cell(25,6,number_format($sumLcFee+$sumLbFee, 2),0,0,'R');
         $pdf->Cell(30,6,'เบิกได้ตามสิทธิ์',0,0,'L');
         $b++;
         $y_axis = $y_axis + $row_height;
     }
 }
 
 //initialize counter
 $i = 2;
 
 foreach($rs_cmf->result() as $row) {
     $pdf->SetFont('AngsanaNew','',$fn_s);
     $pdf->SetY($y_axis);
     $pdf->SetX($x_axis_initial);
     $pdf->Cell(10,6,$b,0,0,'C');
     $pdf->Cell(108,6,iconv('UTF-8','CP874',$row->feeName),0,0,'L');
     $pdf->Cell(25,6,'',0,0,'C');
     $pdf->Cell(25,6,number_format($row->cmfAmt, 2),0,0,'R');
     if($row->feeCanRefund == 'Y')
         $pdf->Cell(30,6,'เบิกได้ตามสิทธิ์',0,0,'L');
     else
         $pdf->Cell(30,6,'เบิกไม่ได้',0,0,'L');
 
     //Go to next row
     $y_axis = $y_axis + $row_height;
     $i = $i + 1;
     $b++;
 } //End while
 
 //initialize counter
 $j = $i;
 
 foreach($rs_cf->result() as $row) {
 
     $pdf->SetFont('AngsanaNew','',$fn_s);
     $pdf->SetY($y_axis);
     $pdf->SetX($x_axis_initial);
     //$pdf->Cell(10,6,$j,0,0,'C');
     $pdf->Cell(10,6,$b,0,0,'C');
     $pdf->Cell(108,6,iconv('UTF-8','CP874',$row->feeName),0,0,'L');
     $pdf->Cell(25,6,'',0,0,'C');
     $pdf->Cell(25,6,number_format($row->cfAmt, 2),0,0,'R');
     if($row->feeCanRefund == 'Y')
         $pdf->Cell(30,6,'เบิกได้ตามสิทธิ์',0,0,'L');
     else
         $pdf->Cell(30,6,'เบิกไม่ได้',0,0,'L');
 
     //Go to next row
     $y_axis = $y_axis + $row_height;
     $j = $j + 1;
     $b++;
 } //End while
 
 $pdf->SetY($y_axis);
 $pdf->SetX($x_axis_initial);
 //$pdf->Cell(10,6,$j,0,0,'C');
 $pdf->Cell(10,6,$b,0,0,'C');
 $pdf->Cell(108,6,'ค่ารักษาสถานภาพการเป็นนักศึกษา',0,0,'L');
 $pdf->Cell(25,6,'',0,0,'C');
 $pdf->Cell(25,6,number_format($sumKssFee, 2),0,0,'R');
 $pdf->Cell(30,6,'เบิกไม่ได้',0,0,'L');
 
 $y_axis = $y_axis + $row_height;
 
 //$pdf->SetFillColor(232,232,232);
 $pdf->SetFont('AngsanaNew','B',14);
 $pdf->setXY(6,165);
 $pdf->Cell(143,6,'รวมยอดเงินที่ต้องชำระทั้งหมด',1,1,'R');
 $pdf->setXY(149,165);
 $pdf->Cell(25,6,number_format($sumTotalAmt, 2),1,1,'R');
 $pdf->setXY(174,165);
 $pdf->Cell(30,6,'',1,1,'L');
 
 $y_axis = $y_axis + $row_height;
 $pdf->setXY(6,50);
 $pdf->Cell(10,115,'',1,0);
 $pdf->setXY(16,50);
 $pdf->Cell(108,115,'',1,0);
 $pdf->setXY(124,50);
 $pdf->Cell(25,115,'',1,0);
 $pdf->setXY(149,50);
 $pdf->Cell(25,115,'',1,0);
 $pdf->setXY(174,50);
 $pdf->Cell(30,115,'',1,0);
 
 
 $pdf->setXY(6,165);
 $pdf->Cell(143,27,'',1,1,'L');
 $pdf->setXY(6,175);
 $pdf->Cell(0,0,'กำหนดชำระเงินภายในวันที่ '.$datepay);
 
 /*$pdf->SetFont('AngsanaNew','',11);
 $pdf->setXY(25,144);
 $pdf->Cell(0,0,'- โปรดตรวจสอบหลักสูตรที่สมัครให้ถูกต้อง พร้อมนำเงินสดไปติอต่อชำระเงินตามรายชื่อธนาคารด้านล่าง',0,0);
 $pdf->setXY(25,148);
 $pdf->Cell(0,0,'ทุกสาขาทั่วประเทศ การสมัครจะสมบูรณ์เมื่อทางธนาคารยืนยันการชำระเงินและได้รับเงินครบถ้วนตามจำนวน',0,0);
 $pdf->setXY(25,152);
 $pdf->Cell(0,0,'เงินที่ระบุ  และมีเจ้าหน้าที่ธนาคาร ลงลายมือและประทับตรากำกับเรียบร้อยแล้วเท่านั้น',0,0);
 $pdf->setXY(22,154);
 $pdf->Cell(120,0,'',1,1);
 */
 /*
 $pdf->setXY(22,157);
 $pdf->Cell(0,0, $clg_name_bank,0,0);
 $pdf->setXY(60,157);
 $pdf->Cell(0,0,'เลขที่บัญชี '. $cfgClgBankNo,0,0);
 if($comcode != ''){
     $pdf->setXY(93,157);
     $pdf->Cell(0,0,'COMCODE: '. $comcode,0,0);
 }
 */
 
 $pdf->SetFont('AngsanaNew','',11);
 $pdf->setXY(149,165);
 $pdf->Cell(55,25,'ผู้รับเงิน..................................',0,0,'C');
 $pdf->setXY(149,169);
 $pdf->Cell(55,25,'วันที่...............................',0,0,'C');
 $pdf->setXY(149,173);
 $pdf->Cell(55,25,'สำหรับเจ้าหน้าที่ธนาคาร',0,0,'C');
 $pdf->setXY(149,177);
 $pdf->Cell(55,25,'(ลงลายมือชื่อและประทับตรา)',0,0,'C');
 $pdf->setXY(149,165);
 $pdf->Cell(55,27,'',1,0);
 
 $pdf->setXY(22,195);
 $pdf->SetFont('AngsanaNew','',9);
 $pdf->Cell(0,0,'พับ - ฉีกตามรอยปะ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -',0,0,'L');
 
 $pdf->image(base_url().$this->config->item("rg_upload_picture").$cfgClgLogo,23,205,17);
 $pdf->SetFont('AngsanaNew','B',14);
 $pdf->SetXY(167,208);
 $pdf->Cell(0,0,'(สำหรับธนาคาร)',0,1,'');
 $pdf->SetFont('AngsanaNew','B',20);
 
 $pdf->SetXY(40,209);
 $pdf->Cell(40,0,$place,0,0,'');
 
 $pdf->setXY(40,215);
 $pdf->SetFont('AngsanaNew','',11);
 $pdf->Cell(0,0,'เพื่อประโยชน์ของท่านโปรดแจ้งเบอร์โทรศัพท์ที่ติดต่อได้',0,0);
 $pdf->SetFont('AngsanaNew','B',15);
 $pdf->setXY(40,215);
 $pdf->Cell(0,0,'ใบแจ้งการชำระเงินเพื่อนำเข้าบัญชี',0,0,'R');
 $pdf->setXY(40,219);
 $pdf->SetFont('AngsanaNew','',11);
 $pdf->Cell(0,0,'โทร./มือถือ..................................',0,0);
 $pdf->setXY(40,222);
 $pdf->Cell(0,0,'Payment Of Applicant Account',0,0,'R');
 
 $pdf->setXY(40,228);
 $pdf->SetFont('AngsanaNew','B',16);
 $pdf->Cell(0,0,'โปรดเรียกเก็บค่าธรรมเนียมธนาคารจากผู้ชำระเงินแยกต่างหาก',0,0,'R');
 
 $pdf->SetFont('AngsanaNew','B',16);
 $pdf->setXY(20,235);
 $pdf->image(base_url().$this->config->item('rg_upload_picture').$cfgClgBankLogo,30,233,9);
 $pdf->setXY(40,235);
 $pdf->Cell(0,0, $clg_name_bank,0,0);
 $pdf->SetFont('AngsanaNew','',16);
 $pdf->setXY(29,242);
 //$pdf->Cell(0,0,'เลขที่บัญชี '. $bookbank,0,0);
 if($comcode != ''){
     $pdf->Cell(0,0,'COMCODE: '. $comcode,0,0);
 } else {
     $pdf->Cell(0,0,'เลขที่บัญชี '. $cfgClgBankNo,0,0);
 }
 /*
 if($comcode != ''){
     $pdf->setXY(75,227);
     $pdf->Cell(0,0,'COMCODE: '. $comcode,0,0);
 }
 */
 $pdf->setXY(29,249);
 $pdf->Cell(0,0,'ชื่อบัญชี '. $clg_name_bank,0,0);
 
 //$pdf->setXY(29,231);
 //$pdf->Cell(0,0,'(ค่าธรรมเนียมธนาคาร 15.00 บาท ทุกธนาคาร)',0,0);
 
 $pdf->SetFont('AngsanaNew','',8);
 $code = '|'.chr(13).$stdCode.chr(13).$refNo.chr(13).$sumTotalAmt.'00';
 $pdf->SetFillColor(0,0,0);;
 $pdf->Code128(32,267,$code.'',80,7);
 //$pdf->Code39(32,267,$code,0.7,7);
 $pdf->setXY(32,274);
 $pdf->SetFont('AngsanaNew','B',11);
 $pdf->Write(5,$code);
 $pdf->setXY(22,253);
 $pdf->Cell(98,0,'',1,0);
 $pdf->SetFont('AngsanaNew','',14);
 $pdf->setXY(23,258);
 $pdf->Cell(0,0,'จำนวนเงิน ',0,0);
 $pdf->SetFont('AngsanaNew','B',14);
 $pdf->setXY(40,258);
 $pdf->Cell(0,0,number_format($sumTotalAmt,2),0,0);
 $pdf->setXY(55,258);
 $pdf->Cell(0,0,'('.iconv('UTF-8','CP874',num2thai($sumTotalAmt)).')',0,0);
 $pdf->SetFont('AngsanaNew','',11);
 $pdf->setXY(46,263);
 $pdf->Cell(0,0,'(ไม่รวมค่าธรรมเนียมธนาคาร)',0,0);
 
 $pdf->setXY(120,235);
 $pdf->Cell(74,24,'',1,0);
 $pdf->SetFont('AngsanaNew','',11);
 $pdf->setXY(120,238);
 $pdf->Cell(0,0,'ชื่อ - สกุล :',0,0);
 $pdf->SetFont('AngsanaNew','B',15);
 $pdf->setXY(133,239);
 $pdf->Cell(0,0,$stdName,0,0);
 $pdf->SetFont('AngsanaNew','',9);
 $pdf->setXY(120,241);
 $pdf->Cell(0,0,'Name',0,0);
 $pdf->SetFont('AngsanaNew','',11);
 $pdf->setXY(120,246);
 $pdf->Cell(0,0,'รหัสนักศึกษา :',0,0);
 $pdf->SetFont('AngsanaNew','B',20);
 $pdf->setXY(138,247);
 $pdf->Cell(0,0,$stdCode,0,0);
 $pdf->SetFont('AngsanaNew','',9);
 $pdf->setXY(120,249);
 $pdf->Cell(0,0,'Appli.no.(Ref.no.1)',0,0);
 $pdf->SetFont('AngsanaNew','',11);
 $pdf->setXY(120,254);
 $pdf->Cell(0,0,'เลขที่ลงทะเบียน :',0,0);
 $pdf->SetFont('AngsanaNew','B',20);
 $pdf->setXY(147,255);
 $pdf->Cell(0,0,$refNo,0,0);
 $pdf->SetFont('AngsanaNew','',9);
 $pdf->setXY(120,257);
 $pdf->Cell(0,0,'Ref.no.(Ref.no.2)',0,0);
 
 $pdf->SetFont('AngsanaNew','',10);
 $pdf->setXY(120,259);
 $pdf->Cell(74,6,'สำหรับเจ้าหน้าที่ธนาคาร / Bank Use Only',1,0,'C');
 
 $pdf->setXY(120,265);
 $pdf->Cell(74,8,'ผู้รับเงิน',1,0);
 $pdf->SetFont('AngsanaNew','',9);
 $pdf->setXY(128,268);
 $pdf->Cell(0,0,'(Received By)',0,0);
 
 $pdf->SetFont('AngsanaNew','',10);
 $pdf->setXY(120,273);
 $pdf->Cell(74,8,'ผู้รับมอบอำนาจ',1,0);
 $pdf->SetFont('AngsanaNew','',9);
 $pdf->setXY(135,276);
 $pdf->Cell(0,0,'(Authorized By)',0,0);
 
 $pdf->setXY(22,281);
 $pdf->Cell(172,12,'',1,0);
 $pdf->SetFont('AngsanaNew','B',12);
 $pdf->setXY(22,284);
 $pdf->Cell(0,0,'หมายเหตุ :',0,0);
 $pdf->setXY(40,284);
 $pdf->SetFont('AngsanaNew','',12);
 $pdf->Cell(0,0,'การลงทะเบียนจะสมบูรณ์เมื่อวิทยาลัยได้รับเงินเรียบร้อยแล้ว',0,0);
 $pdf->setXY(22,204);
 $pdf->Cell(172,89,'',1,0);
 
 $pdf->Output();
 $pdf->Output();
 
 ?>
  |