<html>
<head>
<title>พิมพ์วุฒิบัตร</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874"></head>
<body>
<?php
require_once("../connectdb.php");
require_once("../function_number.php");
require('fpdf.php');
define('FPDF_FONTPATH','font/');
$pdf=new FPDF( 'L' , 'mm' ,'A4');
$pdf->AddFont('angsana','B','angsanab.php');
$pdf->AddFont('angsana','','angsana.php');
$t_id = "";
$sql = "select ".teachers.".t_id AS t_id";
$sql .= " ,".teachers.".t_name AS t_name";
$sql .= " ,".teachers.".t_avid AS t_avid";
$sql .= " ,".teachers.".t_post AS t_post";
$sql .= " ,".activities.".av_id AS av_id";
$sql .= " ,".activities.".av_subject AS av_subject";
$sql .= " ,".certificates.".cc_id AS cc_id";
$sql .= " ,".certificates.".cc_avid AS cc_avid";
$sql .= " ,".certificates.".cc_year AS cc_year";
$sql .= " ,".certificates.".cc_date AS cc_date";
$sql .= " ,".certificates.".cc_no AS cc_no";
$sql .= " ,".certificates.".cc_cer AS cc_cer";
$sql .= " ,".certificates.".cc_start AS cc_start";
$sql .= " ,".certificates.".cc_end AS cc_end";
$sql .= " ,".certificates.".cc_nai AS cc_nai";
$sql .= " ,".certificates.".cc_text AS cc_text";
$sql .= " ,".certificates.".cc_pict AS cc_pict";
$sql .= " ,".certificates.".cc_dean AS cc_dean";
$sql .= " ,".certificates.".cc_dean1 AS cc_dean1";
$sql .= " ,".certificates.".cc_kan AS cc_kan";
$sql .= " ,".certificates.".cc_ar AS cc_ar";
$sql .= " ,".certificates.".cc_ap AS cc_ap";
$sql.= " from ".teachers." ,".activities .",".certificates;
$sql.= " where ".teachers.".t_avid=".$_GET[id] ;
$sql.= " and ".teachers.".t_avid=".activities.".av_id";
$sql.= " and ".certificates.".cc_avid=".activities.".av_id";
$sql.= " ORDER BY t_id ASC";
$conn = mysql_connect($hostname, $dbuser, $dbpassword) or die("Error Connect to Database");
mysql_select_db($dbname,$conn);
mysql_query("SET NAMES TIS620");
mysql_query("SET character_set_results=tis620");
$result = mysql_query($sql) or die($sql . "<br>\n" . $mysql_error()) ;
while($row = mysql_fetch_array($result)){
$total=$row[cc_cer]+$row[t_id]-$row[av_id];
$pdf->AddPage();
$pdf->Image("../".$row[cc_pict],0,0,300,0,'','');
/* เริ่มต้น พิมพ์รายละเอียด */
$pdf->SetXY(10,0);
$pdf->SetFont('angsana','',16);
$pdf->Cell( 268 , 65 , "เลขที่ ".$row[cc_no]." " .thaiNumber("".$total)." / " .thaiNumber("".$row[cc_year])." " , 0 , 1 , 'R' );
$pdf->SetXY(10,58);
$pdf->SetFont('angsana','B',35);
$pdf->Cell( 0 , 55 ,$row[t_name], 0 , 1 , 'C' );
$pdf->SetXY(10,90);
$pdf->SetFont('angsana','B',20);
$pdf->Cell( 0 , 15 ,$row[t_post] , 0 , 1 , 'C' );
$pdf->SetFont('angsana','B',24);
$pdf->Cell( 0 , 10 , "เป็นกรรมการตัดสิน", 0 , 1 , 'C' );
//$pdf->Cell( 0 , 10 , $row[cc_ap], 0 , 1 , 'C' );
$pdf->SetFont('angsana','B',24);
$pdf->Cell( 0 , 10 ,$row[av_subject], 0 , 1 , 'C' );
$pdf->SetFont('angsana','B',22);
$pdf->Cell( 0 , 10 , $row[cc_nai]." " .thaiNumber("".$row[cc_start])." " .$row[cc_kan]. " " .thaiNumber("".$row[cc_end])." เดือน " .$row[cc_dean]." พ.ศ. " .thaiNumber("".$row[cc_year]). "" , 0 , 1 , 'C' );
$pdf->SetFont('angsana','B',22);
$pdf->Cell( 0 , 10 , "ณ ".$row[cc_ar] , 0 , 1 , 'C' );
$pdf->SetFont('angsana','B',22);
$pdf->Cell( 0 , 10 , $row[cc_text] , 0 , 1 , 'C' );
$pdf->SetFont('angsana','B',22);
$pdf->Cell( 0 , 10 , "ให้ไว้ ณ วันที่ " .thaiNumber("".$row[cc_date])." เดือน " .$row[cc_dean1]." พ.ศ. " .thaiNumber("".$row[cc_year]). "" , 0 , 1 , 'C' );
}
$pdf_file = "../BBL.AC.TH-ALL-(".$_GET[id].").pdf";
mysql_close($conn);
$pdf->Output("../TRAIN_ALL_ADMIN_ALL/TRAIN_ALL_ADMIN_ALL/".$pdf_file,"F");
?>
<center>
<META HTTP-EQUIV='Refresh' CONTENT='0;URL=../TRAIN_ALL_ADMIN_ALL/TRAIN_ALL_ADMIN_ALL/<?=$pdf_file?>'>
<img src="../icon/white.jpg"><br>
<a href="../TRAIN_ALL_ADMIN_ALL/TRAIN_ALL_ADMIN_ALL/<?=$pdf_file?>"><img src="../icon/cer_get.jpg" title="โหลดเกียรติบัตร" border="0"></a><br>
หากมีปัญหาในการดาวน์โหลดเกียรติบัตร ให้ทำการ รีเฟรช หน้าเอกสาร PDF หรือ กด F5 ที่คีย์บอร์ด<br>
หลังจากโหลดเอกสารเกียรติบัตรได้แล้ว กรุณา บันทึกเก็บไว้ที่เครื่องคอมพิวเตอร์ของท่านด้วย
</center>
</body>
</html>