Viewing file: v_rptRis998.php (5.71 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
ini_set("memory_limit", '128M');
define('FPDF_FONTPATH',$this->config->item('path_application').'/font/');
//$this->load->library('fpdf_thai');
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,'RIS998',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,286,19);
}
//Page footer
function Footer() {
//Position at 3.0 cm from bottom
$this->SetLineWidth(0.4);
$this->Line(10,199,286,199);
//Arial italic 8
$this->SetY(-7);
$this->SetFont('AngsanaNew','',14);
//Page number
$this->Cell(0,0,'หน้า '.$this->PageNo().'/{nb}',0,0,'R');
$this->SetY(-7);
//$this->Cell(10);
$this->Cell(0,0,'วันที่พิมพ์ : '.date("d/m/y H:i"),0,0,'L');
}
}
//Create new pdf file
$pdf=new PDF('L');
$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);
//Add first page
$pdf->AddPage();
//Set initial y axis position per page
$y_axis_initial = 37;
//Set initial x position of table
$x_axis_initial = 20;
//Set Row Height
$row_height = 6;
$pdf->SetFont('AngsanaNew','B',18);
$pdf->SetX(105);
$pdf->SetY(24);
$pdf->Cell(0,0,'รายงานรายรับลงทะเบียน',0,0,'C');
$pdf->Ln(7);
$pdf->SetFontSize(16);
if($startDate == $endDate)
$pdf->Cell(0,0,'ประจำวันที่ '.iconv('UTF-8','TIS-620',fullDate($startDate)),0,0,'C');
else
$pdf->Cell(0,0,'ตั้งแต่วันที่ '.iconv('UTF-8','TIS-620',fullDate($startDate)).' ถึงวันที่ '.iconv('UTF-8','TIS-620',fullDate($endDate)),0,0,'C');
//print column titles for the actual page
$pdf->SetFillColor(232,232,232);
$pdf->SetFontSize(14);
$pdf->SetY($y_axis_initial);
$pdf->SetX($x_axis_initial);
$pdf->Cell(30,6,'เลขที่ใบลงทะเบียน',1,0,'C',1);
$pdf->Cell(55,6,'ชื่อ-สกุลนักศึกษา',1,0,'C',1);
$pdf->Cell(110,6,'หลักสูตร',1,0,'C',1);
$pdf->Cell(30,6,'เงินในงบประมาณ',1,0,'C',1);
$pdf->Cell(30,6,'เงินนอกงบประมาณ',1,0,'C',1);
$y_axis = $y_axis_initial + $row_height;
//initialize counter
$i = 0;
//Set maximum rows per page
$max = 24;
$sumInAmt = 0;
$sumOutAmt = 0;
foreach($rs_pm->result() as $row) {
if($i == $max) {
$i = 0;
$pdf->AddPage();
$pdf->SetFont('AngsanaNew','B',18);
$pdf->SetX(105);
$pdf->SetY(24);
$pdf->Cell(0,0,'รายงานรายรับลงทะเบียน',0,0,'C');
$pdf->Ln(7);
$pdf->SetFontSize(16);
if($startDate == $endDate)
$pdf->Cell(0,0,'ประจำวันที่ '.iconv('UTF-8','TIS-620',fullDate($startDate)),0,0,'C');
else
$pdf->Cell(0,0,'ตั้งแต่วันที่ '.iconv('UTF-8','TIS-620',fullDate($startDate)).' ถึงวันที่ '.iconv('UTF-8','TIS-620',fullDate($endDate)),0,0,'C');
//print column titles for the actual page
$pdf->SetFillColor(232,232,232);
$pdf->SetFontSize(14);
$pdf->SetY($y_axis_initial);
$pdf->SetX($x_axis_initial);
$pdf->Cell(30,6,'เลขที่ใบลงทะเบียน',1,0,'C',1);
$pdf->Cell(55,6,'ชื่อ-สกุลนักศึกษา',1,0,'C',1);
$pdf->Cell(110,6,'หลักสูตร',1,0,'C',1);
$pdf->Cell(30,6,'เงินในงบประมาณ',1,0,'C',1);
$pdf->Cell(30,6,'เงินนอกงบประมาณ',1,0,'C',1);
$y_axis = $y_axis_initial + $row_height;
}
$cmf_cond = array( 'cmfStdId' => $row->rfStdId,
'cmfAcY' => $row->rfAcY,
'cmfTmId' => $row->rfTmId,
'feeOutBudget' => 'N');
$cmf_cond2 = array( 'cmfStdId' => $row->rfStdId,
'cmfAcY' => $row->rfAcY,
'cmfTmId' => $row->rfTmId,
'feeOutBudget' => 'Y');
$cf_cond = array( 'cfStdId' => $row->rfStdId,
'cfAcY' => $row->rfAcY,
'cfTmId' => $row->rfTmId,
'feeOutBudget' => 'N');
$cf_cond2 = array( 'cfStdId' => $row->rfStdId,
'cfAcY' => $row->rfAcY,
'cfTmId' => $row->rfTmId,
'feeOutBudget' => 'Y');
$crf_cond = array( 'crfStdId' => $row->rfStdId,
'crfAcY' => $row->rfAcY,
'crfTmId' => $row->rfTmId);
$inAmt = $cmf->getSumAmtJoinFee($cmf_cond) + $cf->getSumAmtJoinFee($cf_cond) + $crf->GetSumcrfLecFeeAmtCourseFee($crf_cond) + $crf->GetSumcrfLabFeeAmtCourseFee($crf_cond) + $crf->GetSumcrfKssFeeAmtCourseFee($crf_cond);
$outAmt = $cmf->getSumAmtJoinFee($cmf_cond2) + $cf->getSumAmtJoinFee($cf_cond2);
$pdf->SetFont('AngsanaNew','',14);
$pdf->SetY($y_axis);
$pdf->SetX($x_axis_initial);
$pdf->Cell(30,6,$row->rfRefNo,1,0,'C');
$pdf->Cell(55,6,iconv('UTF-8','TIS-620',$row->prefixName.$row->stdName.' '.$row->stdSurname),1,0,'L');
if( strlen(iconv('UTF-8','TIS-620',$row->curName)) > 65){
$pdf->SetFont('AngsanaNew','',10.5);
}
$pdf->Cell(110,6,iconv('UTF-8','TIS-620',$row->curName),1,0,'L');
$pdf->SetFont('AngsanaNew','',14);
$pdf->Cell(30,6,number_format($inAmt, 2),1,0,'R');
$pdf->Cell(30,6,number_format($outAmt, 2),1,0,'R');
$sumInAmt += $inAmt;
$sumOutAmt += $outAmt;
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
} //End while
$pdf->SetFont('AngsanaNew','B',14);
$pdf->SetY($y_axis);
$pdf->SetX($x_axis_initial);
$pdf->Cell(30,6,'',1,0,'L');
$pdf->Cell(55,6,'',1,0,'L');
$pdf->Cell(110,6,'รวม',1,0,'R');
$pdf->Cell(30,6,number_format($sumInAmt, 2),1,0,'R');
$pdf->Cell(30,6,number_format($sumOutAmt, 2),1,0,'R');
$pdf->Output();
//Create file
$pdf->Output();
?>
|