Path : /var/www/html/smart_kpp2_v2/modules/la/
File Upload :
Current File : /var/www/html/smart_kpp2_v2/modules/la/la_report.php

<?php
function getAge($birthday) {  
$then = strtotime($birthday);  
return(floor((time()-$then)/31556926));  
}  
function phone($pid1){
	$a1=substr($pid1,0,3);
	$a2=substr($pid1,3,3);
	$a3=substr($pid1,6,4);

return $a1."-".$a2."-".$a3;
}
function pid($pid){
	$a1=substr($pid,0,1);
	$a2=substr($pid,1,4);
	$a3=substr($pid,5,5);
	$a4=substr($pid,10,2);
	$a5=substr($pid,12,1);
return $a1."-".$a2."-".$a3."-".$a4."-".$a5;
}
$thmonth=array(  
    "00"=>"",  
    "01"=>"มกราคม",  
    "02"=>"กุมภาพันธ์",  
    "03"=>"มีนาคม",  
    "04"=>"เมษายน",  
    "05"=>"พฤษภาคม",  
    "06"=>"มิถุนายน",   
    "07"=>"กรกฎาคม",  
    "08"=>"สิงหาคม",  
    "09"=>"กันยายน",  
    "10"=>"ตุลาคม",  
    "11"=>"พฤศจิกายน",  
    "12"=>"ธันวาคม"                    
);  
$thmonth2=array(  
    "00"=>"",  
    "01"=>"ม.ค.",  
    "02"=>"ก.พ.",  
    "03"=>"มี.ค.",  
    "04"=>"เม.ย.",  
    "05"=>"พ.ค.",  
    "06"=>"มิ.ย.",   
    "07"=>"ก.ค.",  
    "08"=>"ส.ค.",  
    "09"=>"ก.ย.",  
    "10"=>"ต.ค.",  
    "11"=>"พ.ย.",  
    "12"=>"ธ.ค."                    
);  
error_reporting(E_ALL & ~E_NOTICE);
session_start();
$connect=mysqli_connect($_SESSION['hostname'] ,$_SESSION['user'],$_SESSION['password'],$_SESSION['dbname']) or die("Could not connect MySql");
mysqli_query($connect,"SET NAMES utf8");



// Include the main TCPDF library (search for installation path).
require_once('tcpdf/tcpdf.php');
class MYPDF extends TCPDF {
   
	//Page header
	public function Header() {
		$thmonth=array(  
    "00"=>"",  
    "01"=>"มกราคม",  
    "02"=>"กุมภาพันธ์",  
    "03"=>"มีนาคม",  
    "04"=>"เมษายน",  
    "05"=>"พฤษภาคม",  
    "06"=>"มิถุนายน",   
    "07"=>"กรกฎาคม",  
    "08"=>"สิงหาคม",  
    "09"=>"กันยายน",  
    "10"=>"ตุลาคม",  
    "11"=>"พฤศจิกายน",  
    "12"=>"ธันวาคม"                    
);  
		$head_connect=mysqli_connect($_SESSION['hostname'] ,$_SESSION['user'],$_SESSION['password'],$_SESSION['dbname']) or die("Could not connect MySql");
mysqli_query($head_connect,"SET NAMES utf8");
      global $y;
		
      
		$this->SetFont('thsarabunnew', '', 16,'', 'false');
		
     

$html = '

';



$this->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);


	}

	// Page footer
	
	public function Footer() {
		$footer_connect=mysqli_connect($_SESSION['hostname'] ,$_SESSION['user'],$_SESSION['password'],$_SESSION['dbname']) or die("Could not connect MySql");
mysqli_query($footer_connect,"SET NAMES utf8");
		// Position at 15 mm from bottom
		$this->SetY(-15);
		// Set font
		$this->SetFont('thsarabunnew', '', 14);
		// Page number
		
		
	
	}
}
// create new PDF document

$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('นายสันต์ชัย ประเสริฐศักดิ์');
if($_GET['la_type'] == 1 or $_GET['la_type'] == 2 or $_GET['la_type'] == 3){
$pdf->SetTitle('แบบใบลาปวย ลาคลอดบุตร ลากิจสวนตัว');
} else {
$pdf->SetTitle('แบบใบลาพักผ่อน');	
}
$pdf->SetSubject('ปรับปรุงซ่อมแซมสถานศึกษา');


// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
$pdf->setFooterData(array(0,64,0), array(0,64,128));

// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, 1);

// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

// set some language-dependent strings (optional)
/*

*/
// ---------------------------------------------------------

// set default font subsetting mode
#$pdf->setFontSubsetting(true);

// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('thsarabunnew', '', 14);
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage('P','A4');

// set text shadow effect
#$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));

// Set some content to print
$html = '
';

$html .='

 
  ';
 
$html .='
 

';



// Print text using writeHTMLCell()
if($_GET['la_type']==1 or $_GET['la_type']==2 or $_GET['la_type']==3)
{
$result_la_main = mysqli_query($connect,"SELECT
la_main.id,
la_main.person_id,
la_main.la_type,
la_main.write_at,
la_main.because,
la_main.la_start,
la_main.la_finish,
la_main.la_total,
la_main.last_la_start,
la_main.last_la_finish,
la_main.last_la_total,
la_main.contact,
la_main.contact_tel,
la_main.document,
la_main.no_comment,
la_main.grant_p_selected,
la_main.sick_ago,
la_main.sick_this,
la_main.sick_total,
la_main.privacy_ago,
la_main.privacy_this,
la_main.privacy_total,
la_main.birth_ago,
la_main.birth_this,
la_main.birth_total,
la_main.relax_ago,
la_main.relax_this,
la_main.relax_total,
la_main.relax_collect,
la_main.relax_this_year,
la_main.job_person,
la_main.job_person_sign,
la_main.rec_date,
la_main.officer_comment,
la_main.officer_sign,
la_main.officer_date,
la_main.group_comment,
la_main.group_sign,
la_main.group_date,
la_main.comment_date,
la_main.commander_grant,
la_main.commander_comment,
la_main.commander_sign,
la_main.grant_date,
la_main.school_code,
person_main.prename,
person_main.`name`,
person_main.surname,
person_position.position_name
FROM
la_main
LEFT JOIN person_main ON person_main.person_id = la_main.person_id
LEFT JOIN person_position ON person_position.position_code = person_main.position_code
where la_main.id = '".$_GET['id']."'");
$list_la_main = mysqli_fetch_assoc($result_la_main);

$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
$pdf->SetFont('thsarabunnew', 'B', 16,'', 'false');
$pdf->MultiCell(100, 7,'แบบใบลาป่วย ลาคลอดบุตร ลากิจส่วนตัว', 0,'C', 0, 1, 56, 10);		
$pdf->SetFont('thsarabunnew', '', 14,'', 'false');
$pdf->SetFont('thsarabunnew', '', 16,'', 'false');
$pdf->MultiCell(100, 7,'เขียนที่.............................................................................', 0,'L', 0, 1, 110, 20);
$pdf->MultiCell(100, 7,$list_la_main['write_at'], 0,'L', 0, 1, 121, 19);
$pdf->MultiCell(100, 7,'วันที่..................เดือน....................................พ.ศ.......................', 0,'L', 0, 1, 100, 27);
list($y,$m,$d) = explode("-", $list_la_main['rec_date']);
$pdf->MultiCell(20, 7,intval($d), 0,'C', 0, 1, 106, 26);
$pdf->MultiCell(30, 7,$thmonth[$m], 0,'C', 0, 1, 134, 26);
$pdf->MultiCell(30, 7,$y+543, 0,'C', 0, 1, 165, 26);
if($list_la_main['la_type']==1){$la_type = 'ลาป่วย';}
if($list_la_main['la_type']==2){$la_type = 'ลากิจ';}
if($list_la_main['la_type']==3){$la_type = 'ลาคลอด';}
if($list_la_main['la_type']==4){$la_type = 'ลาพักผ่อน';}
$pdf->MultiCell(100, 7,'เรื่อง  ', 0,'L', 0, 1, 20, 40);
$pdf->MultiCell(100, 7,$la_type, 0,'L', 0, 1, 30, 40);
$pdf->MultiCell(150, 7,'เรียน  ผู้อำนวยการ'.$_SESSION['office_name'], 0,'L', 0, 1, 20, 47);
$pdf->MultiCell(150, 7,'ข้าพเจ้า.................................................................ตำแหน่ง......................................................................', 0,'L', 0, 1, 43, 58);
$full_name = $list_la_main['prename'].''.$list_la_main['name'].' '.$list_la_main['surname'];
$pdf->MultiCell(50, 7,$full_name, 0,'C', 0, 1, 60, 57);
$pdf->MultiCell(150, 7,$list_la_main['position_name'], 0,'L', 0, 1, 128, 57);
$pdf->MultiCell(200, 7,'สังกัด..................................................................................................................................................................................', 0,'L', 0, 1, 20, 65);
$pdf->MultiCell(200, 7,$_SESSION['office_name'], 0,'L', 0, 1, 33, 64);
$pdf->MultiCell(200, 7,'ขอลา', 0,'L', 0, 1, 20, 81);
$pdf->Image('images/box.jpg', 38, 75, 4, 4);
$pdf->MultiCell(200, 7,'ป่วย', 0,'L', 0, 1, 51, 74);
$pdf->Image('images/box.jpg', 38, 82, 4, 4);
$pdf->MultiCell(200, 7,'ลากิจส่วนตัว  เนื่องจาก...................................................................................................................', 0,'L', 0, 1, 51, 81);
$pdf->Image('images/box.jpg', 38, 89, 4, 4);
$pdf->MultiCell(200, 7,'ลาคลอดบุตร', 0,'L', 0, 1, 51, 88);
if($list_la_main['la_type']==1){
$pdf->Image('images/check.png', 38, 75, 4, 4);
}
if($list_la_main['la_type']==2){
	$pdf->Image('images/check.png', 38, 82, 4, 4);
	$pdf->MultiCell(200, 7,$list_la_main['because'], 0,'L', 0, 1, 87, 80.6);
	}
if($list_la_main['la_type']==3){$pdf->Image('images/check.png', 38, 89, 4, 4);}

$pdf->MultiCell(200, 7,'ตั้งแต่วันที่ ............................................... ถึงวันที่ ..................................................... มีกำหนดเวลา ..........................วัน', 0,'L', 0, 1, 20, 97);
list($y,$m,$d) = explode("-", $list_la_main['la_start']);
$year = $y +543;
$day_start = intval($d).' '.$thmonth[$m].' พ.ศ. '.$year;
$pdf->MultiCell(50, 7,$day_start, 0,'C', 0, 1, 34, 96.5);
list($y,$m,$d) = explode("-", $list_la_main['la_finish']);
$year = $y +543;
$day_finish = intval($d).' '.$thmonth[$m].' พ.ศ. '.$year;
$pdf->MultiCell(50, 7,$day_finish, 0,'C', 0, 1, 93, 96.5);
$pdf->MultiCell(50, 7,$list_la_main['la_total'], 0,'C', 0, 1, 150, 96.5);
$pdf->MultiCell(200, 7,'ข้าพเจ้าได้ลา         ป่วย         กิจส่วนตัว        คลอดบุตร ครั้งสุดท้ายตั้งแต่วันที่ .......................................................', 0,'L', 0, 1, 20, 104);
list($y,$m,$d) = explode("-", $list_la_main['last_la_start']);
$year = $y +543;
$last_day_start = intval($d).' '.$thmonth[$m].' พ.ศ. '.$year;
$pdf->MultiCell(70, 7,$last_day_start, 0,'C', 0, 1, 133, 103.5);
list($y,$m,$d) = explode("-", $list_la_main['last_la_finish']);
$year = $y +543;
$last_day_finish = intval($d).' '.$thmonth[$m].' พ.ศ. '.$year;
$pdf->MultiCell(70, 7,$last_day_start, 0,'C', 0, 1, 30, 110.5);
$pdf->Image('images/box.jpg', 43, 105, 4, 4);
$pdf->Image('images/box.jpg', 61, 105, 4, 4);
$pdf->Image('images/box.jpg', 86, 105, 4, 4);
$pdf->MultiCell(200, 7,'ถึงวันที่ ...................................................................... มีกำหนด .......................... วัน ในระหว่างลาจะติดต่อข้าพเจ้าได้ที่', 0,'L', 0, 1, 20, 111);
$pdf->MultiCell(70, 7,$list_la_main['last_la_total'], 0,'C', 0, 1, 90, 110.5);
if($list_la_main['la_type']==1){
$pdf->Image('images/check.png', 43, 105, 4, 4);
}
if($list_la_main['la_type']==2){
	$pdf->Image('images/check.png', 61, 105, 4, 4);
	
}
if($list_la_main['la_type']==3){$pdf->Image('images/check.png', 86, 105, 4, 4);}
$pdf->MultiCell(200, 7,'...........................................................................................................................................................................................', 0,'L', 0, 1, 20, 118);
$pdf->MultiCell(200, 7,$list_la_main['contact'].' เบอร์โทรศัพท์ '.$list_la_main['contact_tel'], 0,'L', 0, 1, 20, 117.5);
$pdf->MultiCell(200, 7,'ขอแสดงความนับถือ', 0,'L', 0, 1, 137, 130);
$pdf->MultiCell(200, 7,'ลงชื่อ........................................................', 0,'L', 0, 1, 120, 139);
$pdf->MultiCell(200, 7,'(...............................................................)', 0,'L', 0, 1, 120, 146);
$pdf->MultiCell(100, 7,$list_la_main['prename'].''.$list_la_main['name'].' '.$list_la_main['surname'], 0,'C', 0, 1, 101.5, 145.5);
$pdf->SetFont('thsarabunnew', 'BIU', 16,'', 'false');

$pdf->MultiCell(200, 7,'สภิติการลาในปีงบประมาณนี้', 0,'L', 0, 1, 20, 146);
#เส้นแนวนอน
$pdf->SetFont('thsarabunnew', '', 16,'', 'false');
$pdf->Line(20, 153, 85, 153, $style2);
$pdf->Line(20, 159, 85, 159, $style2);
$pdf->Line(20, 171, 85, 171, $style2);
$pdf->Line(20, 183, 85, 183, $style2);
$pdf->Line(20, 195, 85, 195, $style2);
#เส้นแนวตั้ง
$pdf->Line(20, 153, 20, 195, $style2);
$pdf->Line(36.25, 153, 36.25, 195, $style2);
$pdf->Line(52.5, 153, 52.5, 195, $style2);
$pdf->Line(68.75, 153, 68.75, 195, $style2);
$pdf->Line(85, 153, 85, 195, $style2);
#ข้อความ
$pdf->SetFont('thsarabunnew', '', 14,'', 'false');
$pdf->MultiCell(200, 7,'ประเภทลา', 0,'L', 0, 1, 20, 154);
$pdf->MultiCell(200, 7,'ลามาแล้ว', 0,'L', 0, 1, 38, 154);
$pdf->MultiCell(200, 7,'ลาครั้งนี้', 0,'L', 0, 1, 54, 154);
$pdf->MultiCell(200, 7,'รวมเป็น', 0,'L', 0, 1, 71, 154);
$pdf->MultiCell(200, 7,'ป่วย', 0,'L', 0, 1, 24, 160);
$pdf->MultiCell(200, 7,'กิจส่วนตัว', 0,'L', 0, 1, 20.5, 172);
$pdf->MultiCell(200, 7,'คลอดบุตร', 0,'L', 0, 1, 20.5, 184);

$pdf->MultiCell(10, 7,$list_la_main['sick_ago'], 0,'C', 0, 1, 40, 160);
$pdf->MultiCell(10, 7,$list_la_main['sick_this'], 0,'C', 0, 1, 56, 160);
$pdf->MultiCell(10, 7,$list_la_main['sick_total'], 0,'C', 0, 1, 72, 160);

$pdf->MultiCell(10, 7,$list_la_main['privacy_ago'], 0,'C', 0, 1, 40, 172);
$pdf->MultiCell(10, 7,$list_la_main['privacy_this'], 0,'C', 0, 1, 56, 172);
$pdf->MultiCell(10, 7,$list_la_main['privacy_total'], 0,'C', 0, 1, 72, 172);

$pdf->MultiCell(10, 7,$list_la_main['birth_ago'], 0,'C', 0, 1, 40, 184);
$pdf->MultiCell(10, 7,$list_la_main['birth_this'], 0,'C', 0, 1, 56, 184);
$pdf->MultiCell(10, 7,$list_la_main['birth_total'], 0,'C', 0, 1, 72, 184);

$pdf->MultiCell(200, 7,'(วันทำการ)', 0,'L', 0, 1, 36.3, 166);
$pdf->MultiCell(200, 7,'(วันทำการ)', 0,'L', 0, 1, 36.3, 178);
$pdf->MultiCell(200, 7,'(วันทำการ)', 0,'L', 0, 1, 36.3, 190);

$pdf->MultiCell(200, 7,'(วันทำการ)', 0,'L', 0, 1, 52.7, 166);
$pdf->MultiCell(200, 7,'(วันทำการ)', 0,'L', 0, 1, 52.7, 178);
$pdf->MultiCell(200, 7,'(วันทำการ)', 0,'L', 0, 1, 52.7, 190);

$pdf->MultiCell(200, 7,'(วันทำการ)', 0,'L', 0, 1, 69.1, 166);
$pdf->MultiCell(200, 7,'(วันทำการ)', 0,'L', 0, 1, 69.1, 178);
$pdf->MultiCell(200, 7,'(วันทำการ)', 0,'L', 0, 1, 69.1, 190);

$pdf->MultiCell(200, 7,'ความเห็นของผู้บังคับบัญชา', 0,'L', 0, 1, 121, 160);
$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 121, 166);
$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 121, 172);
$pdf->MultiCell(200, 7,'(ลงชื่อ).............................................................................', 0,'L', 0, 1, 121, 178);
$pdf->MultiCell(200, 7,'ตำแหน่ง..........................................................................', 0,'L', 0, 1, 121, 184);
$pdf->MultiCell(200, 7,'วันที่.................................................................................', 0,'L', 0, 1, 121, 190);

$pdf->SetFont('thsarabunnew', 'U', 16,'', 'false');
$pdf->MultiCell(200, 7,'คำสั่ง', 0,'L', 0, 1, 122, 196);
$pdf->SetFont('thsarabunnew', '', 16,'', 'false');
$pdf->MultiCell(200, 7,'อนุญาต           ไม่อนุญาต', 0,'L', 0, 1, 140, 204);
$pdf->Image('images/box.jpg', 135, 205, 4, 4);
$pdf->Image('images/box.jpg', 159, 205, 4, 4);
$pdf->SetFont('thsarabunnew', '', 14,'', 'false');
$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 121,211);
$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 121, 217);
$pdf->MultiCell(200, 7,'(ลงชื่อ).............................................................................', 0,'L', 0, 1, 121, 223);
$pdf->MultiCell(200, 7,'ตำแหน่ง..........................................................................', 0,'L', 0, 1, 121, 230);
$pdf->MultiCell(200, 7,'วันที่.................................................................................', 0,'L', 0, 1, 121, 236);

$pdf->MultiCell(200, 7,'(ลงชื่อ)............................................................................ผู้ตรวจสอบ', 0,'L', 0, 1, 20,211);
$pdf->MultiCell(200, 7,'ตำแหน่ง..........................................................................', 0,'L', 0, 1, 20, 217);
$pdf->MultiCell(200, 7,'วันที่................................................................................', 0,'L', 0, 1, 20, 223);

}
if($_GET['la_type']==4){
	$result_la_main = mysqli_query($connect,"SELECT
la_main.id,
la_main.person_id,
la_main.la_type,
la_main.write_at,
la_main.because,
la_main.la_start,
la_main.la_finish,
la_main.la_total,
la_main.last_la_start,
la_main.last_la_finish,
la_main.last_la_total,
la_main.contact,
la_main.contact_tel,
la_main.document,
la_main.no_comment,
la_main.grant_p_selected,
la_main.sick_ago,
la_main.sick_this,
la_main.sick_total,
la_main.privacy_ago,
la_main.privacy_this,
la_main.privacy_total,
la_main.birth_ago,
la_main.birth_this,
la_main.birth_total,
la_main.relax_ago,
la_main.relax_this,
la_main.relax_total,
la_main.relax_collect,
la_main.relax_this_year,
la_main.job_person,
la_main.job_person_sign,
la_main.rec_date,
la_main.officer_comment,
la_main.officer_sign,
la_main.officer_date,
la_main.group_comment,
la_main.group_sign,
la_main.group_date,
la_main.comment_date,
la_main.commander_grant,
la_main.commander_comment,
la_main.commander_sign,
la_main.grant_date,
la_main.school_code,
person_main.prename,
person_main.`name`,
person_main.surname,
person_position.position_name
FROM
la_main
LEFT JOIN person_main ON person_main.person_id = la_main.person_id
LEFT JOIN person_position ON person_position.position_code = person_main.position_code
where la_main.id = '".$_GET['id']."'");
$list_la_main = mysqli_fetch_assoc($result_la_main);
		$pdf->SetFont('thsarabunnew', 'B', 16,'', 'false');
		$pdf->MultiCell(100, 7,'แบบใบลาพักผ่อน', 0,'C', 0, 1, 56, 10);		
		$pdf->SetFont('thsarabunnew', '', 14,'', 'false');
		$pdf->SetFont('thsarabunnew', '', 16,'', 'false');
		$pdf->MultiCell(100, 7,'เขียนที่.............................................................................', 0,'L', 0, 1, 110, 20);
		$pdf->MultiCell(100, 7,$list_la_main['write_at'], 0,'L', 0, 1, 121, 19);
		$pdf->MultiCell(100, 7,'วันที่..................เดือน....................................พ.ศ.......................', 0,'L', 0, 1, 100, 27);
		list($y,$m,$d) = explode("-", $list_la_main['rec_date']);
		$pdf->MultiCell(20, 7,intval($d), 0,'C', 0, 1, 106, 26);
		$pdf->MultiCell(30, 7,$thmonth[$m], 0,'C', 0, 1, 134, 26);
		$pdf->MultiCell(30, 7,$y+543, 0,'C', 0, 1, 165, 26);
		if($list_la_main['la_type']==4){$la_type = 'ลาพักผ่อน';}
		$pdf->MultiCell(100, 7,'เรื่อง  ', 0,'L', 0, 1, 20, 40);
		$pdf->MultiCell(100, 7,$la_type, 0,'L', 0, 1, 30, 40);
		$pdf->MultiCell(100, 7,'เรียน  ', 0,'L', 0, 1, 20, 47);
		$pdf->MultiCell(150, 7,'ผู้อำนวยการ'.$_SESSION['office_name'], 0,'L', 0, 1, 30, 47);
		$pdf->MultiCell(150, 7,'ข้าพเจ้า.................................................................ตำแหน่ง......................................................................', 0,'L', 0, 1, 43, 58);
		$pdf->MultiCell(50, 7,$list_la_main['prename'].''.$list_la_main['name'].' '.$list_la_main['surname'], 0,'C', 0, 1, 60, 57);
		$pdf->MultiCell(100, 7,$list_la_main['position_name'], 0,'C', 0, 1, 110, 57);
		$pdf->MultiCell(200, 7,'สังกัด..................................................................................................................................................................................', 0,'L', 0, 1, 20, 65);
		$pdf->MultiCell(200, 7,$_SESSION['office_name'], 0,'L', 0, 1, 33, 64);
		$pdf->MultiCell(200, 7,'มีวันลาพักผ่อนสะสม...................วันทำการ มีสิทธิลาพักผ่อนประจำปีนี้อีก 10 วันทำการ รวมเป็น..................วันทำการ', 0,'L', 0, 1, 20, 72);
		$pdf->MultiCell(50, 7,$list_la_main['relax_collect'], 0,'C', 0, 1, 35, 71.2);
		$pdf->MultiCell(50, 7,$list_la_main['relax_this_year'], 0,'C', 0, 1, 144, 71.2);
		list($y,$m,$d) = explode("-", $list_la_main['la_start']);
$pdf->MultiCell(200, 7,'ขอลาพักผ่อนตั้งแต่วันที่.................................................... ถึงวันที่................................................... มีกำหนด.............วัน', 0,'L', 0, 1, 20, 79);
		$year = $y +543;
		$pdf->MultiCell(70, 7,intval($d).' '.$thmonth[$m].' พ.ศ. '.$year, 0,'C', 0, 1, 45, 78.3);
		list($y,$m,$d) = explode("-", $list_la_main['la_finish']);
		$year = $y +543;
		$pdf->MultiCell(70, 7,intval($d).' '.$thmonth[$m].' พ.ศ. '.$year, 0,'C', 0, 1, 103, 78.3);
		$pdf->MultiCell(70, 7,$list_la_main['la_total'], 0,'C', 0, 1, 147.5, 78.3);

$pdf->MultiCell(200, 7,'ในระหว่างลาจะติดต่อข้าพเจ้าได้ที่.....................................................................................................................................', 0,'L', 0, 1, 20, 86);
$pdf->MultiCell(150, 7,$list_la_main['contact'], 0,'L', 0, 1, 73, 85.5);
$pdf->MultiCell(200, 7,'............................................................................................................................................................................................', 0,'L', 0, 1, 20, 92);
$pdf->MultiCell(200, 7,'เบอร์โทรศัพท์ '.$list_la_main['contact_tel'], 0,'L', 0, 1, 20, 91.5);
$pdf->MultiCell(200, 7,'สถิติการลาในปีงบประมาณนี้', 0,'L', 0, 1, 35, 99);
$pdf->Line(20, 106, 93, 106, $style2);
$pdf->Line(20, 125, 93, 125, $style2);
$pdf->Line(20, 139, 93, 139, $style2);

#เส้นแนวตั้ง
$pdf->Line(20, 106, 20, 139, $style2);
$pdf->Line(44.3, 106, 44.3, 139, $style2);
$pdf->Line(68.6, 106, 68.6, 139, $style2);
$pdf->Line(93, 106, 93, 139, $style2);

$pdf->MultiCell(200, 7,'ขอแสดงความนับถือ', 0,'L', 0, 1, 130, 106);
$pdf->MultiCell(200, 7,'ลงชื่อ..................................................................................', 0,'L', 0, 1, 105, 113);
$pdf->MultiCell(200, 7,'(........................................................................................)', 0,'L', 0, 1, 105, 120);
$pdf->MultiCell(100, 7,$list_la_main['prename'].''.$list_la_main['name'].' '.$list_la_main['surname'], 0,'C', 0, 1, 95, 119.4);

$pdf->MultiCell(200, 7,'ความเห็นของผู้บังคับบัญชา', 0,'L', 0, 1, 106, 142);
$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 106, 149);
$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 106, 156);
$pdf->MultiCell(200, 7,'(ลงชื่อ).............................................................................', 0,'L', 0, 1, 106, 163);
$pdf->MultiCell(200, 7,'ตำแหน่ง..........................................................................', 0,'L', 0, 1, 106, 170);
$pdf->MultiCell(200, 7,'วันที่.................................................................................', 0,'L', 0, 1, 106, 177);

$pdf->MultiCell(200, 7,'อนุญาต           ไม่อนุญาต', 0,'L', 0, 1, 130, 190);
$pdf->Image('images/box.jpg', 125, 191, 4, 4);
$pdf->Image('images/box.jpg', 149, 191, 4, 4);
$pdf->SetFont('thsarabunnew', '', 16,'', 'false');
$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 106,197);
$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 106, 204);
$pdf->MultiCell(200, 7,'(ลงชื่อ).............................................................................', 0,'L', 0, 1, 106, 211);
$pdf->MultiCell(200, 7,'ตำแหน่ง..........................................................................', 0,'L', 0, 1, 106, 218);
$pdf->MultiCell(200, 7,'วันที่.................................................................................', 0,'L', 0, 1, 106, 225);

$pdf->MultiCell(200, 7,'(ลงชื่อ)..........................................................ผู้ตรวจสอบ', 0,'L', 0, 1, 20,142);
$pdf->MultiCell(200, 7,'ตำแหน่ง..........................................................................', 0,'L', 0, 1, 20, 149);
$pdf->MultiCell(200, 7,'วันที่................................................................................', 0,'L', 0, 1, 20, 156);
$pdf->MultiCell(200, 7,'ลามาแล้ว', 0,'L', 0, 1, 24, 107);
$pdf->MultiCell(200, 7,'ลาครั้งนี้', 0,'L', 0, 1, 50, 107);
$pdf->MultiCell(200, 7,'รวมเป็น', 0,'L', 0, 1, 74, 107);

$pdf->MultiCell(15, 7,$list_la_main['relax_ago'], 0,'C', 0, 1, 24, 130);
$pdf->MultiCell(15, 7,$list_la_main['relax_this'], 0,'C', 0, 1, 50, 130);
$pdf->MultiCell(15, 7,$list_la_main['relax_total'], 0,'C', 0, 1, 74, 130);

$pdf->MultiCell(200, 7,'(วันทำการ)', 0,'L', 0, 1, 23, 113);
$pdf->MultiCell(200, 7,'(วันทำการ)', 0,'L', 0, 1, 48, 113);
$pdf->MultiCell(200, 7,'(วันทำการ)', 0,'L', 0, 1, 72, 113);
}


if($row_list['school_id'] == '1'){
$pdf->Image('../../'.$row_list['main_pic'], 173,41.55, 23, 28);
}else{
	$pdf->Image('../../'.$row_list['sch_pic'], 173,41.55, 23, 28);
	}
$pdf->SetFont('thsarabunnew', '', 28,'', 'false');
$pdf->MultiCell(100, 7,$mainprename.''.$mainname.' '.$mainsurname, 0,'C', 0, 1,99, 263.5);	
// ---------------------------------------------------------
// Close and output PDF document
// This method has several options, check the source code documentation for more information.

$pdf->SetFont('thsarabunnew', '', 14);
// Add a page
// This method has several options, check the source code documentation for more information.
#if(isset($row_list['pic_regis_home']) and $row_list['pic_regis_home'] != "");{
	$picture="pic_upload/".$row_list['pic_regis_home'];
	if(isset($row_list['pic_regis_home']) and $row_list['pic_regis_home'] != ""){
$pdf->AddPage('P','A4');
$html = '

<img src="'.$picture.'">

';
	
$pdf->writeHTML($html, true, true, true, true, '');}
#}
$pdf->Output('idcard.pdf', 'I');
$pdf->close();

//============================================================+
// END OF FILE
//============================================================+