Viewing file:      v_printPaymentRegis2AllPDF.php (4.49 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 $refNo;
     var $dd;
     var $mm;
     var $yy;
     var $cfgClgName;
     var $cfgClgAddr;
 
     //Page header
     function Header () {
         $tmp = explode('|', $this->refNo, 2);
 
         //Title
         $this->SetY(30);
         $this->SetFont('AngsanaNew','B',14);
         $this->Cell(0,7,iconv('UTF-8', 'TIS-620', 'เล่มที่ '.$tmp[0]),0,0,'L');
         $this->SetX(-180);
         $this->SetFontSize(18);
         $this->Cell(0,7,iconv('UTF-8', 'TIS-620', 'ใบสำคัญรับเงิน'),0,0,'C');
         $this->SetX(-10);
         $this->SetFontSize(14);
         $this->Cell(0,7,iconv('UTF-8', 'TIS-620', 'เลขที่ '.$tmp[1]),0,0,'R');
         //Contents
         $this->SetY(45);
         $this->SetFont('AngsanaNew','',16);
         $this->Cell(0,7,iconv('UTF-8', 'TIS-620', 'วันที่   '.$this->dd.'   เดือน   '.$this->mm.'   พ.ศ.   '.$this->yy),0,0,'R');
         $this->SetY(60);
         $this->Cell(20,7,'',0,0,'L');
         $this->Cell(20,7,iconv('UTF-8', 'TIS-620', 'ข้าพเจ้า'),0,0,'L');
         $this->Cell(0,7,iconv('UTF-8', 'TIS-620', $this->cfgClgName),0,0,'L');
         $this->Ln(7);
         $this->Cell(40,7,iconv('UTF-8', 'TIS-620', 'อยู่ที่'),0,0,'L');
         $this->Cell(0,7,iconv('UTF-8', 'TIS-620', $this->cfgClgAddr),0,0,'L');
     }
 } //End class
 
 //Create new pdf file
 $pdf = new PDF();
 $pdf->cfgClgName = $cfgClgName;
 $pdf->cfgClgAddr = $cfgClgAddr;
 
 //Set thai font
 $pdf->SetThaiFont();
 
 $pdf->AliasNbPages();
 
 //Open file
 $pdf->Open();
 
 //Disable automatic page break
 $pdf->SetAutoPageBreak(false);
 
 $pdf->SetLeftMargin(30);
 $pdf->SetRightMargin(30);
 
 //set initial y axis position per page
 $y_axis_initial = 90;
 
 //Set Row Height
 $row_height = 7;
 
 //initialize counter
 foreach ($rs as $key => $val) {
     $row_pm = $rs[$key]['qu_pm']->row();
     $row_std = $rs[$key]['qu_std']->row();
 
     list($yy, $mm, $dd) = preg_split('[-]', getval('pmPrintDate', $row_pm));
     $pdf->refNo = getval('pmRefNo', $row_pm);
     $pdf->dd = $dd;
     $pdf->mm = getMonthTh($mm);
     $pdf->yy = $yy + 543;
 
     $pdf->AddPage();
 
     $pdf->SetFontSize(16);
     $pdf->SetY(75);
     $pdf->Cell(20,7,iconv('UTF-8', 'TIS-620', 'ได้รับเงินจาก'),0,0,'L');
     $pdf->Cell(100,7,iconv('UTF-8', 'TIS-620', getval('prefixName', $row_std).getval('stdName', $row_std).' '.getval('stdSurname', $row_std).'     ปีการศึกษา  '.$rs[$key]['tmCode'].'/'.$rs[$key]['acY']),0,0,'C');
     $pdf->Cell(0,7,iconv('UTF-8', 'TIS-620', 'ดังรายการต่อไปนี้'),0,0,'L');
     
     //print column titles for the current page
     $pdf->SetFillColor(232,232,232);
     $pdf->SetFont('AngsanaNew','B',16);
     $pdf->SetY($y_axis_initial);
     $pdf->Cell(105,7,iconv('UTF-8', 'TIS-620', 'รายการ'),1,0,'C',1);
     $pdf->Cell(45,7,iconv('UTF-8', 'TIS-620', 'จำนวนเงิน'),1,0,'C',1);
     
     //Go to next row
     $y_axis = $y_axis_initial + $row_height;
 
     $pdf->SetFont('AngsanaNew','',16);
     for ($i = 0; $i < count($rs[$key]['item']); $i++) {
         $item = $rs[$key]['item'][$i];
 
         $pdf->SetY($y_axis);
         $pdf->Cell(105,7,iconv('UTF-8', 'TIS-620', $item[0]),1,0);
         $pdf->Cell(45,7,number_format($item[1], 2),1,0,'R');
 
         $y_axis = $y_axis + $row_height;
     }
 
     $pdf->SetFont('AngsanaNew','B',16);
     $pdf->SetY($y_axis);
     $pdf->Cell(105,7,iconv('UTF-8', 'TIS-620', 'รวม'),1,0,'R');
     $pdf->Cell(45,7,number_format($rs[$key]['sumAmt'], 2),1,0,'R');
 
     $y_axis = $y_axis + $row_height;
 
     $pdf->SetFont('AngsanaNew','',16);
     $pdf->SetY($y_axis);
     $pdf->Cell(60,7,iconv('UTF-8', 'TIS-620', 'จำนวนเงิน'),0,0,'R');
     $pdf->Cell(90,7,iconv('UTF-8', 'TIS-620', num2thai($rs[$key]['sumAmt'])),1,0,'L',1);
 
     $y_axis = $y_axis + $row_height;
 
     $pdf->SetY($y_axis);
     $pdf->Cell(60,7,'',0,0);
     $pdf->Cell(90,7,iconv('UTF-8', 'TIS-620', '(ตัวอักษร)'),0,0,'C');
 
     $y_axis = $y_axis + $row_height;
 
     $pdf->SetY($y_axis);
     $pdf->Cell(0,7,iconv('UTF-8', 'TIS-620', 'ได้รับเงินไว้เรียบร้อยแล้ว'),0,0);
 
     $y_axis = $y_axis + (2*$row_height);
 
     $pdf->SetY($y_axis);
     $pdf->Cell(0,7,iconv('UTF-8', 'TIS-620', 'ลงชื่อ...................................................ผู้รับเงิน'),0,0,'R');
 
     $y_axis = $y_axis + $row_height;
 
     $pdf->SetY($y_axis);
     $pdf->Cell(0,7,iconv('UTF-8', 'TIS-620', 'ตำแหน่ง.........................................................'),0,0,'R');
 }
 
 //Create file
 $pdf->Output();
 ?>
  |