Viewing file: v_prePrintPaymentRegisAllPDF.php (3.54 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 {
} //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 Row Height
$row_height = 6;
$cnt = 1;
$rcSpace = 0;
foreach ($rs as $key => $val) {
$row_pm = $rs[$key]['qu_pm']->row();
$row_std = $rs[$key]['qu_std']->row();
if ($cnt % getval('rcPerPage', $row_rc) == 0 ) {
$rcSpace += getval('rcSpace', $row_rc);
}
$pdf->AddPage();
// ถ้าไม่ต้องการให้แสดง ให้ใส่ rcX... = -1
$pdf->SetFont('AngsanaNew','',14);
$pdf->SetXY(getval('rcXClgName', $row_rc), getval('rcYClgName', $row_rc) + $rcSpace);
$pdf->Cell(0,6,iconv('UTF-8', 'TIS-620', $cfgClgName),0,0);
list($yy, $mm, $dd) = preg_split('[-]', getval('pmPrintDate', $row_pm));
$pdf->SetXY(getval('rcXDay', $row_rc), getval('rcYDate', $row_rc) + $rcSpace);
$pdf->Cell($pdf->GetStringWidth($dd),6,$dd,0,0);
$pdf->SetX(getval('rcXMonth', $row_rc));
$pdf->Cell($pdf->GetStringWidth($mm),6,iconv('UTF-8', 'TIS-620', getMonthTh($mm)),0,0);
$pdf->SetX(getval('rcXYear', $row_rc));
$pdf->Cell($pdf->GetStringWidth($yy),6,$yy + 543,0,0);
$pdf->SetXY(getval('rcXStdName', $row_rc), getval('rcYStdName', $row_rc) + $rcSpace);
$pdf->Cell(0,6,iconv('UTF-8', 'TIS-620', $row_std->prefixName.$row_std->stdName.' '.$row_std->stdSurname),0,0);
$pdf->SetXY(getval('rcXCurName', $row_rc), getval('rcYCurName', $row_rc) + $rcSpace);
$pdf->Cell(0,6,iconv('UTF-8', 'TIS-620', $row_std->ccName.' ชั้นปี '.$rs[$key]['syCode']),0,0);//curName
$pdf->SetXY(getval('rcXStdCode', $row_rc), getval('rcYTerm', $row_rc) + $rcSpace);
$pdf->Cell(0,6,$row_std->stdCode,0,0);
$pdf->SetX(getval('rcXAcY', $row_rc));
$pdf->Cell(0,6,$rs[$key]['acY'],0,0);
$pdf->SetX(getval('rcXTerm', $row_rc));
$pdf->Cell(0,6,$rs[$key]['tmCode'],0,0);
//$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) + $rcSpace;
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->MultiCell(getval('rcXAmt', $row_rc) - getval('rcXItem', $row_rc),6,iconv('UTF-8', 'TIS-620', $item[0]));
$pdf->SetXY(getval('rcXAmt', $row_rc), $y_axis);
$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) + $rcSpace);
$pdf->Cell(20,6,number_format($rs[$key]['sumAmt'], 2),0,0,'R');
$pdf->SetXY(getval('rcXStr', $row_rc), getval('rcYStr', $row_rc) + $rcSpace);
$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) + $rcSpace);
$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) + $rcSpace);
$pdf->Cell(0,6,iconv('UTF-8', 'TIS-620', getval('prsPosition', $row_prs)),0,0);
$cnt++;
}
//Create file
$pdf->Output();
?>
|