Viewing file: prePrintMemoTrainingPDF.php (9.45 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;
$query = " SELECT * 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.Teacher_code='".$_REQUEST['Teacher_code']."'";
$result = $dbObj->execQuery($query);
$rss = $dbObj->fetchArray($result);
$query3 = "Select * From college Where collegeStatus ='1'";
$result3 = $dbObj->execQuery($query3);
$rs3 = $dbObj->fetchArray($result3);
//$query4 = "SELECT * 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' ";
$query4 = " SELECT * FROM training_tb WHERE Training_code='$Training_code' AND Teacher_code='$Teacher_code' ";
$result4 = $dbObj->execQuery($query4);
$rs = $dbObj->fetchArray($result4);
$query2 = "Select * From province Where provinceId ='".$rs['provinceId']."' ";
$result2 = $dbObj->execQuery($query2);
$rs2 = $dbObj->fetchArray($result2);
function getMonthTh($mm) {
if($mm=='01') { $mm='มกราคม'; }
else if($mm=='02') { $mm='กุมภาพันธ์'; }
else if($mm=='03') { $mm='มีนาคม'; }
else if($mm=='04') { $mm='เมษายน'; }
else if($mm=='05') { $mm='พฤษภาคม';}
else if($mm=='06') { $mm='มิถุนายน'; }
else if($mm=='07') { $mm='กรกฎาคม'; }
else if($mm=='08') { $mm='สิงหาคม'; }
else if($mm=='09') { $mm='กันยายน'; }
else if($mm=='10') { $mm='ตุลาคม';}
else if($mm=='11') { $mm='พฤศจิกายน';}
else if($mm=='12') { $mm='ธันวาคม'; }
return "$mm";
}
//Create new pdf file
$pdf = new FPDF();
//Set thai font
$pdf->SetThaiFont();
$pdf->AddPage();
//-- Load Form Image to Background
$pdf->Image('../form/memo_training.jpg', 0, 0, 203, 297);
//-- Set Font
$pdf->SetFont('AngsanaNew','',15);
//-- College name and Date , Top-Right Position
$date = explode("-",$rs[Date]);
$day = intval($date[2]);
$month = getMonthTh(intval($date[1]));
$year = intval($date[0]);
$pdf->Text(39,30.5,$rs3['collegeName']);
if(!empty($day)){
$pdf->SetXY(134.5,32.5);
$pdf->Cell(9,5,$day,0,0,'C');
$pdf->SetXY(150,32.5);
$pdf->Cell(23.5,5,$month,0,0,'C');
$pdf->SetXY(178.4,32.5);
$pdf->Cell(12,5,$year,0,0,'C');
}
else{
$pdf->SetXY(134.5,32.5);
$pdf->Cell(9,5,'-',0,0,'C');
$pdf->SetXY(150,32.5);
$pdf->Cell(23.5,5,'-',0,0,'C');
$pdf->SetXY(178.4,32.5);
$pdf->Cell(12,5,'-',0,0,'C');
}
//-- Set Font
$pdf->SetFont('AngsanaNew','',13);
//-- Request header
if(!empty($rs['maNo'])){
$pdf->SetXY(25,32.5);
$pdf->Cell(32,5,$rs['maNo'],0,0,'C');
}
else{
$pdf->SetXY(25,32.5);
$pdf->Cell(32,5,'-',0,0,'C');
}
$pdf->Text(30,51.2,'ผู้อำนวยการ '.$rs3['collegeName']);
//-- Body
$pdf->SetXY(56.8,53.5);
$pdf->Cell(64.8,5,$rs4['No_in'],0,0,'C');
$pdf->SetXY(131.5,53.5);
$pdf->Cell(42.5,5,$rs['Dated'],0,0,'C');
$pdf->SetXY(30.5,60);
$pdf->Cell(86,5,$rss['prefixName'].' '.$rss['Teacher_name'].' '.$rss['Teacher_lastname'],0,0,'C');
$pdf->SetXY(128,60);
$pdf->Cell(62,5,$rss['Position_name'],0,0,'C');
if(strlen($rs['Training_name']) <= 80) $pdf->SetFont('AngsanaNew','',13);
else if(strlen($rs['Training_name']) > 80 && strlen($rs['Training_name']) <= 105) $pdf->SetFont('AngsanaNew','',11);
else $pdf->SetFont('AngsanaNew','',9.3);
$trainingName = (strlen($rs['Training_name']) > 110)?substr($rs['Training_name'],0,111)."...":$rs['Training_name'];
$pdf->SetXY(67.5,66.8);
$pdf->Cell(123,5,$trainingName,0,0,'C');
$pdf->SetFont('AngsanaNew','',13);
$date_start = explode("-",$rs['Date_start']);
$day_start = intval($date_start[2]);
$month_start = getMonthTh(intval($date_start[1]));
$year_start = intval($date_start[0]);
$date_finish = explode("-",$rs['Date_finish']);
$day_finish = intval($date_finish[2]);
$month_finish = getMonthTh(intval($date_finish[1]));
$year_finish = intval($date_finish[0]);
$pdf->SetXY(37.5,73.6);
$pdf->Cell(29,5,$day_start.' '.$month_start.' '.$year_start,0,0,'C');
$pdf->SetXY(76,73.6);
$pdf->Cell(30.5,5,$day_finish.' '.$month_finish.' '.$year_finish,0,0,'C');
$pdf->SetXY(142,73.6);
$pdf->Cell(10,5,$rs['Day'],0,0,'C');
$pdf->SetXY(174,73.6);
$pdf->Cell(15.5,5,$rs['Year_std'],0,0,'C');
$pdf->SetXY(38,80.1);
$pdf->Cell(95,5,$rs['CNEU'],0,0,'C');
$pdf->SetXY(142.3,80.1);
$pdf->Cell(47,5,$rs2['provinceName'],0,0,'C');
if(!empty($rs['Organiz'])){
$pdf->SetXY(40,87);
$pdf->Cell(55.3,5,$rs['Organiz'],0,0,'C');
}
else{
$pdf->SetXY(40,87);
$pdf->Cell(55.3,5,'-',0,0,'C');
}
if(!empty($rs['Cradit'])){
$pdf->SetXY(113,87);
$pdf->Cell(20,5,$rs['Cradit'],0,0,'C');
}
else{
$pdf->SetXY(113,87);
$pdf->Cell(20,5,'-',0,0,'C');
}
if(!empty($rs['Budget_use'])){
$pdf->SetXY(161.3,87);
$pdf->Cell(22.5,5,$rs['Budget_use'],0,0,'C');
}
else{
$pdf->SetXY(161.3,87);
$pdf->Cell(22.5,5,'0',0,0,'C');
}
$pdf->SetFont('AngsanaNew','B',27);
switch($rs['Training_std']){
case "Y" : $pdf->Text(59,105,'/'); break;
case "N" : $pdf->Text(95.8,105,'/'); break;
}
$pdf->SetFont('AngsanaNew','',13);
if(!empty($rs['Objective'])){
$pdf->SetXY(81,107);
$pdf->Cell(108.5,5,htmlspecialchars_decode(nl2br($rs['Objective'])),0,0,'C');
}
else{
$pdf->SetXY(81,107);
$pdf->Cell(108.5,5,'-',0,0,'C');
}
$pdf->SetFont('AngsanaNew','B',27);
switch($rs['Content']){
case "วิชาการ" : $pdf->Text(59,118.5,'/'); break;
case "บริหาร" : $pdf->Text(83.5,118.5,'/'); break;
case "วิชาชีพเฉพาะ" : $pdf->Text(105.3,118.5,'/'); break;
case "ทัศนคติ" : $pdf->Text(133.7,118.5,'/'); break;
}
if($rs['Capability_1'] == "ในการปฏิบัติงาน") $pdf->Text(83.5,132,'/');
if($rs['Capability_2'] == "ในเรื่องกฏหมายและระเบียบราชการ") $pdf->Text(132.8,132,'/');
if($rs['Performance_1'] == "การมุ่งผลสัมฤทธิ์") $pdf->Text(83.5,138.6,'/');
if($rs['Performance_2'] == "การบริการที่ดี") $pdf->Text(132.8,138.6,'/');
if($rs['Performance_3'] == "การสั่งสมความเชี่ยวชาญในงานอาชีพ") $pdf->Text(83.5,145.3,'/');
if($rs['Performance_4'] == "จริยธรรม") $pdf->Text(157.5,145.3,'/');
if($rs['Performance_5'] == "การทำงานเป็นทีม") $pdf->Text(83.5,152,'/');
if($rs['PerformanceYear_1'] == "การคิดเชิงวิเคราะห์") $pdf->Text(83.5,158.5,'/');
if($rs['PerformanceYear_2'] == "ความถูกต้องของงาน") $pdf->Text(132.8,158.5,'/');
if($rs['PerformanceYear_3'] == "ความเข้าใจขององค์กร") $pdf->Text(83.5,165,'/');
if($rs['PerformanceYear_4'] == "การมองภาพองค์กร") $pdf->Text(132.8,165,'/');
if($rs['Skills_1'] == "การคิดคำนวณ") $pdf->Text(83.5,172,'/');
if($rs['Skills_2'] == "การใช้ภาษาอังกฤษ") $pdf->Text(132.8,172,'/');
if($rs['Skills_3'] == "การใช้คอมพิวเตอร์") $pdf->Text(83.5,178.5,'/');
if($rs['Skills_4'] == "การจัดการข้อมูล") $pdf->Text(132.8,178.5,'/');
$pdf->SetFont('AngsanaNew','',13);
if(!empty($rs['Apply'])){
$pdf->SetXY(25,186.8);
$pdf->Cell(164,5,htmlspecialchars_decode(nl2br($rs['Apply'])),0,0,'L');
}
else{
$pdf->SetXY(25,186.8);
$pdf->Cell(164,5,'-',0,0,'C');
}
$pdf->SetFont('AngsanaNew','B',27);
switch($rs['Sources']){
case "เงินงบประมาณ" : $pdf->Text(54.5,198.5,'/'); break;
case "เงินรายได้" : $pdf->Text(80.5,198.5,'/'); break;
case "หน่วยงานผู้จัด" : $pdf->Text(100,198.5,'/'); break;
default :
$pdf->Text(125,198.5,'/');
$pdf->SetFont('AngsanaNew','',13);
$pdf->SetXY(152,193.8);
$pdf->Cell(37,5,$rs['Sources'],0,0,'C');
break;
}
$pdf->SetFont('AngsanaNew','B',27);
switch($rs['Training_type']){
case "1" : $pdf->Text(54.7,205.3,'/'); break;
case "2" : $pdf->Text(75,205.3,'/'); break;
case "3" : $pdf->Text(100.7,205.3,'/'); break;
case "4" : $pdf->Text(117,205.3,'/'); break;
case "7" : $pdf->Text(133.8,205.3,'/'); break;
case "6" : $pdf->Text(152.5,205.3,'/'); break;
}
$pdf->SetFont('AngsanaNew','',13);
if(!empty($rs['Major'])){
$pdf->SetXY(42,207);
$pdf->Cell(69,5,$rs['Major'],0,0,'C');
}
else{
$pdf->SetXY(42,207);
$pdf->Cell(69,5,'-',0,0,'C');
}
$pdf->SetFont('AngsanaNew','B',27);
switch($rs['Place']){
case "ในประเทศ" : $pdf->Text(121.5,212,'/'); break;
case "ต่างประเทศ" : $pdf->Text(145,212,'/'); break;
}
//-- signature
$pdf->SetFont('AngsanaNew','',13);
/*$pdf->SetXY(34,211.8);
$pdf->Cell(41.5,5,$rs['First_name'].' '.$rs['Teacher_name'].' '.$rs['Teacher_lastname'],0,0,'C');
$pdf->SetXY(32,218.5);
$pdf->Cell(44,5,$rs['Position_name'],0,0,'C');*/
$pdf->SetXY(115,226);
$pdf->Cell(43.8,5,$rss['prefixName'].' '.$rss['Teacher_name'].' '.$rss['Teacher_lastname'],0,0,'C');
$pdf->SetXY(118.6,232.7);
$pdf->Cell(53,5,$rss['Position_name'],0,0,'C');
/*$pdf->SetXY(117,211.8);
$pdf->Cell(49.5,5,$rs4['First_name'].' '.$rs4['Teacher_name'].' '.$rs4['Teacher_lastname'],0,0,'C');
$pdf->SetXY(117,218.5);
$pdf->Cell(48,5,$rs4['Position_name'],0,0,'C');*/
$pdf->SetXY(29,246);
$pdf->Cell(44,5,$rs4['prefixName'].' '.$rs4['Teacher_name'].' '.$rs4['Teacher_lastname'],0,0,'C');
$pdf->SetXY(32.5,252.5);
$pdf->Cell(58,5,$rs4['Position_name'],0,0,'C');
//Create file
$pdf->Output();
?>
|