Viewing file: prePrintMoneyFormPDF-2.php (5.59 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//PDF USING MULTIPLE PAGES
//FILE CREATED BY: Carlos José Vásquez Sáez
//YOU CAN CONTACT ME: carlos@magallaneslibre.com
//FROM PUNTA ARENAS, MAGALLANES
//INOVO GROUP - http://www.inovo.cl
/** Configuration */
require_once( "../configuration.php" );
require_once( $_Config_absolute_path . "/includes/connMySQL.class.php");
require('../fpdf/fpdf.php');
/** Create Database Object */
$dbObj = new DBConn;
/** Config Table for This Page */
$myTable = "personal_tb";
$myTable1 = "budget_year_tb";
$myTable2 ="durable_type_tb";
/*----- personal_tb--------*/
$query = "SELECT *, prefixName as First_name FROM personal_tb LEFT JOIN prefix ON personal_tb.First_name = prefix.prefixId LEFT JOIN position_tb ON personal_tb.PositionId = position_tb.PositionId LEFT JOIN faculty_tb ON personal_tb.Faculty_code = faculty_tb.Faculty_code LEFT JOIN training_tb ON personal_tb.Teacher_code = training_tb.Teacher_code LEFT JOIN formaoffice ON training_tb.Teacher_code = formaoffice.Teacher_code WHERE training_tb.Teacher_code = '".$_REQUEST["Teacher_code"]." ' and training_tb.Training_code = '".$_REQUEST["Training_code"]." ' and formaoffice.codeId = '".$_REQUEST["codeId"]." ' ";
$result = $dbObj->execQuery($query);
$rss = $dbObj->fetchArray($result);
$query = "SELECT *, prefixName as First_name FROM personal_tb LEFT JOIN prefix ON personal_tb.First_name = prefix.prefixId LEFT JOIN position_tb ON personal_tb.PositionId = position_tb.PositionId LEFT JOIN faculty_tb ON personal_tb.Faculty_code = faculty_tb.Faculty_code LEFT JOIN training_tb ON personal_tb.Teacher_code = training_tb.Teacher_code LEFT JOIN formaoffice ON training_tb.Teacher_code = formaoffice.Teacher_code LEFT JOIN formofficemoney ON formaoffice.codeId = formofficemoney.codeId WHERE formofficemoney.maNo = '".$_REQUEST["maNo"]." ' and formofficemoney.Teacher_code = '".$_REQUEST["Flag"]." ' Group By formofficemoney.maNo , formofficemoney.Flag ";
$result5 = $dbObj->execQuery($query);
$rss5 = $dbObj->fetchArray($result5);
$query3 = "Select * From college Where collegeStatus ='1'";
$result3 = $dbObj->execQuery($query3);
$rs3 = $dbObj->fetchArray($result3);
$query4 = "SELECT *, prefixName as First_name FROM personal_tb LEFT JOIN prefix ON personal_tb.First_name = prefix.prefixId LEFT JOIN position_tb ON personal_tb.PositionId = position_tb.PositionId LEFT JOIN faculty_tb ON personal_tb.Faculty_code = faculty_tb.Faculty_code Where personal_tb.Faculty_code = '".$rs['Faculty_code']."' and personal_tb.TeacherId = '1'";
$result4 = $dbObj->execQuery($query4);
$rs4 = $dbObj->fetchArray($result4);
function readNumber($number, $len) {
if($number=='0') { $number = ""; }
else if($number=='1') {
if($len==2) { $number = ""; }
else { $number = "˹Öè§"; }
}
else if($number=='2') {
if($len==2) { $number = "ÂÕè"; }
else { $number = "Êͧ"; }
}
else if($number=='3') { $number = "ÊÒÁ"; }
else if($number=='4') { $number = "ÊÕè"; }
else if($number=='5') { $number = "ËéÒ"; }
else if($number=='6') { $number = "Ë¡"; }
else if($number=='7') { $number = "à¨ç´"; }
else if($number=='8') { $number = "á»´"; }
else if($number=='9') { $number = "à¡éÒ"; }
return $number;
}
function readUnit($len) {
if($len=='1') { $len = ""; }
else if($len=='2') { $len = "ÊÔº"; }
else if($len=='3') { $len = "ÃéÍÂ"; }
else if($len=='4') { $len = "¾Ñ¹"; }
else if($len=='5') { $len = "ËÁ×è¹"; }
else if($len=='6') { $len = "áʹ"; }
else if($len=='7') { $len = "ÅéÒ¹"; }
return $len;
}
function convertNumberToString($amount) {
list($baht, $satang) = split('[.]', $amount);
while(strlen($satang) < 2)
$satang .= '0';
$str = "";
$len = strlen($baht);
$i = 0;
while($i <= strlen($baht)) {
if($len==1 && $baht[$i-1]!=0 && $baht[$i]==1)
$str .= "àÍç´";
else
$str .= readNumber($baht[$i], $len);
if($baht[$i] != 0)
$str .= readUnit($len);
$len--;
$i++;
}
if($str != "")
$str .= "ºÒ·";
$len = strlen($satang);
$i = 0;
while($i <= strlen($satang)) {
if($len==1 && $satang[$i-1]!=0 && $satang[$i]==1)
$str .= "àÍç´";
else
$str .= readNumber($satang[$i], $len);
if($satang[$i] != 0)
$str .= readUnit($len);
$len--;
$i++;
}
if($satang != '00')
$str .= "ʵҧ¤ì";
return $str;
}
//----------------------------------------
//Create new pdf file
$pdf = new FPDF();
//Set thai font
$pdf->SetThaiFont();
$pdf->AddPage();
//-- Load Form Image to Background
$pdf->Image('../form/FormMoney-2.jpg', 0, 0, 210, 297);
//-- Set Font
$pdf->SetFont('AngsanaNew','',13);
//-- Body ª×èÍ µÓáË¹è§ ¼ÙéÃѺà§Ô¹
if(!empty($rss5['First_name'])){
$pdf->SetXY(14,94);
$pdf->Cell(73,5,$rss5['First_name'].' '.$rss5['Teacher_name'].' '.$rss5['Teacher_lastname'],0,0,'C');
}
if(!empty($rss5['Position_name'])){
$pdf->SetXY(20,101);
$pdf->Cell(56,5,$rss5['Position_name'],0,0,'C');
}
// ÃÇÁ·Ñé§ÊÔé¹
$sql1 = " SELECT SUM(Budget_use) AS SumB5 FROM formofficemoney WHERE Flag='$Flag' and maNo='$maNo' ";
$result1 = mysql_query($sql1);
$rss1 = mysql_fetch_array($result1);
if(!empty($rss1['SumB5'])){
$pdf->SetXY(130,73.5);
$pdf->Cell(45,5,number_format($rss1['SumB5'],2,'.',','),0,0,'C');
}
else{
$pdf->SetXY(130,73.5);
$pdf->Cell(45,5,'-',0,0,'C');
}
// ¨Ó¹Ç¹à§Ô¹ (µÑÇÍÑ¡ÉÃ)
if(!empty($rss1['SumB5'])){
$SumB5 = convertNumberToString($rss1['SumB5']);
$pdf->SetXY(50,80.5);
$pdf->Cell(45,5,$SumB5,0,0,'C');
}
else{
$pdf->SetXY(60,203);
$pdf->Cell(45,5,'-',0,0,'C');
}
//Create file
$pdf->Output();
?>
|