Viewing file: v_prePrintPaymentRegisAllPDF_1.php (3.11 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 $yDate;
var $xDay;
var $xMonth;
var $xYear;
var $refNo;
var $dd;
var $mm;
var $yy;
//Page header
function Header () {
$this->SetFont('AngsanaNew','',14);
$this->SetXY($this->xDay, $this->yDate);
$this->Cell($this->GetStringWidth($this->dd),6,$this->dd,0,0,'C');
$this->SetX($this->xMonth);
$this->Cell($this->GetStringWidth($this->mm),6,iconv('UTF-8', 'TIS-620', $this->mm),0,0,'C');
$this->SetX($this->xYear);
$this->Cell($this->GetStringWidth($this->yy),6,$this->yy,0,0,'C');
}
} //End class
$row_rc = isset($qu_rc) ? $qu_rc->row() : NULL;
$row_prs = isset($qu_prs) ? $qu_prs->row() : NULL;
//Create new pdf file
$pdf = new PDF('P','mm',array(getval('rcWPaper', $row_rc), getval('rcHPaper', $row_rc)));
//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
$pdf->yDate = getval('rcYDate', $row_rc);
$pdf->xDay = getval('rcXDay', $row_rc);
$pdf->xMonth = getval('rcXMonth', $row_rc);
$pdf->xYear = getval('rcXYear', $row_rc);
//Set Row Height
$row_height = 6;
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->SetXY(getval('rcXStdName', $row_rc), getval('rcYStdName', $row_rc));
$pdf->Cell(0,6,iconv('UTF-8', 'TIS-620', $row_std->prefixName.$row_std->stdName.' '.$row_std->stdSurname.' ['.$row_std->curAbbr.' ชั้นปี '.$row_std->syCode.']'),0,0);
$pdf->Ln(6);
$pdf->SetX(getval('rcXTerm', $row_rc));
$pdf->Cell(0,6,iconv('UTF-8', 'TIS-620', 'ภาคการศึกษาที่ '.$rs[$key]['tmCode'].'/'.$rs[$key]['acY']),0,0);
//Go to next row
$y_axis = getval('rcYItem', $row_rc);
if (isset($rs[$key]['item'])) {
for ($i = 0; $i < count($rs[$key]['item']); $i++) {
$item = $rs[$key]['item'][$i];
$pdf->SetXY(getval('rcXItem', $row_rc), $y_axis);
$pdf->Cell(getval('rcXAmt', $row_rc) - getval('rcXItem', $row_rc),6,iconv('UTF-8', 'TIS-620', $item[0]),0,0);
$pdf->Cell(20,6,number_format($item[1], 2),0,0,'R');
$y_axis = $y_axis + $row_height;
}
}
$pdf->SetXY(getval('rcXAmt', $row_rc), getval('rcYTotal', $row_rc));
$pdf->Cell(20,6,number_format($rs[$key]['sumAmt'], 2),0,0,'R');
$pdf->SetXY(getval('rcXStr', $row_rc), getval('rcYStr', $row_rc));
$pdf->Cell(0,6,iconv('UTF-8', 'TIS-620', num2thai($rs[$key]['sumAmt'])),0,0,'L');
$pdf->SetXY(getval('rcXPrsName', $row_rc), getval('rcYPrsName', $row_rc));
$pdf->Cell(0,6,iconv('UTF-8', 'TIS-620', getval('name', $row_prs)),0,0);
$pdf->SetXY(getval('rcXPrsPosition', $row_rc), getval('rcYPrsPosition', $row_rc));
$pdf->Cell(0,6,iconv('UTF-8', 'TIS-620', getval('prsPosition', $row_prs)),0,0);
}
//Create file
$pdf->Output();
?>
|