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

<?php
//require_once('../../amssplus_connect.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->Image('images/krut.png', 20, 10, 20, 20); //ตำแหน่งแนวนอน , แนวตั้ง , กว้าง , สูง
$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, 100, 20);
		$pdf->MultiCell(100, 7,$list_la_main['write_at'], 0,'L', 0, 1, 112, 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.png', 38, 75, 4, 4);
$pdf->MultiCell(200, 7,'ป่วย', 0,'L', 0, 1, 51, 74);
$pdf->Image('images/box.png', 38, 82, 4, 4);
$pdf->MultiCell(200, 7,'ลากิจส่วนตัว  เนื่องจาก...................................................................................................................', 0,'L', 0, 1, 51, 82);
$pdf->Image('images/box.png', 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.png', 43, 105, 4, 4);
$pdf->Image('images/box.png', 61, 105, 4, 4);
$pdf->Image('images/box.png', 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);

//ลายเซ็นต์
$person_id = $list_la_main['person_id'];
$signature = "../../signature/"."$person_id".".png";
$pdf->Image($signature, 135, 139, 30, 0); //ตำแหน่งแนวนอน , แนวตั้ง , กว้าง , สูง ลายเซ็นต์

$pdf->MultiCell(200, 7,'ขอแสดงความนับถือ', 0,'L', 0, 1, 137, 130);
$pdf->MultiCell(200, 7,'ลงชื่อ..................................................................', 0,'L', 0, 1, 120, 149);
$pdf->MultiCell(200, 7,'(.........................................................................)', 0,'L', 0, 1, 120, 155);
$pdf->MultiCell(100, 7,$list_la_main['prename'].''.$list_la_main['name'].' '.$list_la_main['surname'], 0,'C', 0, 1, 101.5, 154);
$pdf->SetFont('thsarabunnew', 'BIU', 16,'', 'false');

$pdf->MultiCell(200, 7,'สถิติการลาในปีงบประมาณนี้', 0,'L', 0, 1, 20, 126);
#เส้นแนวนอน
$pdf->SetFont('thsarabunnew', '', 16,'', 'false');
$pdf->Line(20, 133, 85, 133, $style2);
$pdf->Line(20, 139, 85, 139, $style2);
$pdf->Line(20, 151, 85, 151, $style2);
$pdf->Line(20, 163, 85, 163, $style2);
$pdf->Line(20, 175, 85, 175, $style2);
#เส้นแนวตั้ง
$pdf->Line(20, 133, 20, 175, $style2);
$pdf->Line(36.25, 133, 36.25, 175, $style2);
$pdf->Line(52.5, 133, 52.5, 175, $style2);
$pdf->Line(68.75, 133, 68.75, 175, $style2);
$pdf->Line(85, 133, 85, 175, $style2);
#ข้อความ
$pdf->SetFont('thsarabunnew', '', 14,'', 'false');
$pdf->MultiCell(200, 7,'ประเภทลา', 0,'L', 0, 1, 20, 134);
$pdf->MultiCell(200, 7,'ลามาแล้ว', 0,'L', 0, 1, 38, 134);
$pdf->MultiCell(200, 7,'ลาครั้งนี้', 0,'L', 0, 1, 54, 134);
$pdf->MultiCell(200, 7,'รวมเป็น', 0,'L', 0, 1, 71, 134);
$pdf->MultiCell(200, 7,'ป่วย', 0,'L', 0, 1, 24, 140);
$pdf->MultiCell(200, 7,'กิจส่วนตัว', 0,'L', 0, 1, 20.5, 152);
$pdf->MultiCell(200, 7,'คลอดบุตร', 0,'L', 0, 1, 20.5, 164);

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

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

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

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

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

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


//ผู้ตรวจสอบ
$sql_person = "SELECT
person_main.prename,
person_main.`name`,
person_main.surname,
person_position.position_name
FROM
person_main
INNER JOIN person_position ON person_main.position_code = person_position.position_code
WHERE
person_main.person_id = '$list_la_main[officer_sign]'";
$dbquery_person = mysqli_query($connect,$sql_person);
$result_person = mysqli_fetch_array($dbquery_person);
$officer_name =$result_person['prename'].$result_person['name']." ".$result_person['surname'];
$officer_position =$result_person['position_name'];
$pdf->MultiCell(200, 7, $list_la_main['officer_comment'], 0,'L', 0, 1, 20,180);
$pdf->MultiCell(200, 7,'.......................................................................................', 0,'L', 0, 1, 20,181);
//ลายเซ็นต์
$officer_sign = $list_la_main['officer_sign'];
$officer_sign2 = "../../signature/"."$officer_sign".".png";
if($officer_sign > ''){
$pdf->Image($officer_sign2, 50, 186, 30, 0); //ตำแหน่งแนวนอน , แนวตั้ง , กว้าง , สูง ลายเซ็นต์
}
$pdf->MultiCell(195, 7,'(ลงชื่อ)...........................................................ผู้ตรวจสอบ', 0,'L', 0, 1, 20,200);
$pdf->MultiCell(200, 7,$officer_name, 0,'L', 0, 1, 40,208);
$pdf->MultiCell(200, 7,'(......................................................................................)', 0,'L', 0, 1, 20, 209);
$pdf->MultiCell(200, 7,$officer_position, 0,'L', 0, 1, 40,216);
//$pdf->MultiCell(200, 7,'นักจัดการงานทั่วไป', 0,'L', 0, 1, 40,169); //ตย.
$pdf->MultiCell(200, 7,'ตำแหน่ง..........................................................................', 0,'L', 0, 1, 20, 217);

$officer_date=$list_la_main['officer_date'];
if($officer_date > ''){
list($y,$m,$d) = explode("-", $officer_date);
		$year = $y +543;
		$pdf->MultiCell(70, 7,intval($d).' '.$thmonth[$m].' '.$year, 0,'L', 0, 1, 40,223);
}
$pdf->MultiCell(200, 7,'วันที่................................................................................', 0,'L', 0, 1, 20, 224);
//จบผู้ตรวจสอบ

//ผู้บังคับบัญชาต้น ผอ.กลุ่ม
$sql_person = "SELECT
person_main.prename,
person_main.`name`,
person_main.surname,
person_position.position_name
FROM
person_main
INNER JOIN person_position ON person_main.position_code = person_position.position_code
WHERE
person_main.person_id = '$list_la_main[group_sign]'";
$dbquery_person = mysqli_query($connect,$sql_person);
$result_person = mysqli_fetch_array($dbquery_person);
$fullname_group =$result_person['prename'].$result_person['name']." ".$result_person['surname'];
$position_group =$result_person['position_name'];

$pdf->MultiCell(200, 7,'ความเห็นของผู้บังคับบัญชาขั้นต้น (ผอ.กลุ่ม)', 0,'L', 0, 1, 106, 175);
//$pdf->MultiCell(200, 7,'เห็นควรอนุมัติ', 0,'L', 0, 1, 106,149); //ตย.
$pdf->MultiCell(200, 7, $list_la_main['group_comment'], 0,'L', 0, 1, 106,180);
$pdf->MultiCell(200, 7,'.......................................................................................................', 0,'L', 0, 1, 106,181);
//$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 106, 204);

//ลายเซ็นต์
$group_sign = $list_la_main['group_sign'];
$group_sign2 = "../../signature/"."$group_sign".".png";
if($group_sign > ''){
$pdf->Image($group_sign2, 135, 186, 30, 0); //ตำแหน่งแนวนอน , แนวตั้ง , กว้าง , สูง ลายเซ็นต์
}

$pdf->MultiCell(200, 7,'(ลงชื่อ)............................................................................................', 0,'L', 0, 1, 106, 200);
$pdf->MultiCell(200, 7,$fullname_group, 0,'L', 0, 1, 125,208);
//$pdf->MultiCell(200, 7,'นางอิสรีย์  ปิติฤทธิ์', 0,'L', 0, 1, 125,169); //ตย.
$pdf->MultiCell(200, 7,'(.....................................................................................................)', 0,'L', 0, 1, 106, 209);
$pdf->MultiCell(200, 7,$position_group, 0,'L', 0, 1, 121,216);
//$pdf->MultiCell(200, 7,'ผู้อำนวยการกลุ่มอำนวยการ', 0,'L', 0, 1, 124,176); //ตย.
$pdf->MultiCell(200, 7,'ตำแหน่ง.........................................................................................', 0,'L', 0, 1, 106, 217);

$group_date=$list_la_main['group_date'];
if($group_date > ''){
list($y,$m,$d) = explode("-", $group_date);
		$year = $y +543;
		$pdf->MultiCell(70, 7,intval($d).' '.$thmonth[$m].' '.$year, 0,'L', 0, 1, 124,223);
}
$pdf->MultiCell(200, 7,'วันที่................................................................................................', 0,'L', 0, 1, 106, 224);

//จบผู้บังคับบัญชาต้น ผอ.กลุ่ม

//รอง ผอ.
$sql_person = "SELECT
person_main.prename,
person_main.`name`,
person_main.surname,
person_position.position_name
FROM
person_main
INNER JOIN person_position ON person_main.position_code = person_position.position_code
WHERE
person_main.person_id = '$list_la_main[group_sign2]'";
$dbquery_person = mysqli_query($connect,$sql_person);
$result_person = mysqli_fetch_array($dbquery_person);
$group_name2 =$result_person['prename'].$result_person['name']." ".$result_person['surname'];
$group_position2 =$result_person['position_name'];

$pdf->SetFont('thsarabunnew', '', 14,'', 'false');
//$pdf->MultiCell(200, 7,'ทราบ/ลงนามแล้ว', 0,'L', 0, 1, 106,201); //ตย.
$pdf->MultiCell(200, 7, $list_la_main['group_comment2'], 0,'L', 0, 1, 20,245);
$pdf->MultiCell(200, 7,'.........................................................................................', 0,'L', 0, 1, 20,246);
//$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 106, 204);

//ลายเซ็นต์
$group_sign2 = $list_la_main['group_sign2'];
$group_sign22 = "../../signature/"."$group_sign2".".png";
if($group_sign2 > ''){
$pdf->Image($group_sign22, 40, 253, 32, 0); //ตำแหน่งแนวนอน , แนวตั้ง , กว้าง , สูง ลายเซ็นต์
}

$pdf->MultiCell(200, 7,'(ลงชื่อ)............................................................................', 0,'L', 0, 1, 20, 268);
$pdf->MultiCell(200, 7,$group_name2, 0,'L', 0, 1, 40,274);
//$pdf->MultiCell(200, 7,'นายวรรณชัย  บุสนาม', 0,'L', 0, 1, 125,221); //ตย.
$pdf->MultiCell(200, 7,'(.....................................................................................)', 0,'L', 0, 1, 20, 275);
$pdf->MultiCell(200, 7,$group_position2, 0,'L', 0, 1, 40,281);
//$pdf->MultiCell(200, 7,'ผู้อำนวยการสำนักงานเขตพื้นที่การศึกษา', 0,'L', 0, 1, 124,228); //ตย.
$pdf->MultiCell(200, 7,'ตำแหน่ง.........................................................................', 0,'L', 0, 1, 20, 282);

$group_date2=$list_la_main['group_date2'];
if($group_date2 > ''){
list($y,$m,$d) = explode("-", $group_date2);
		$year = $y +543;
		$pdf->MultiCell(70, 7,intval($d).' '.$thmonth[$m].' '.$year, 0,'L', 0, 1, 40,287);
}
$pdf->MultiCell(200, 7,'วันที่...............................................................................', 0,'L', 0, 1, 20, 288);

//จบรอง ผอ.

//ผู้อนุมัติ
$sql_person = "SELECT
person_main.prename,
person_main.`name`,
person_main.surname,
person_position.position_name
FROM
person_main
INNER JOIN person_position ON person_main.position_code = person_position.position_code
WHERE
person_main.person_id = '$list_la_main[commander_sign]'";
$dbquery_person = mysqli_query($connect,$sql_person);
$result_person = mysqli_fetch_array($dbquery_person);
$grant_name =$result_person['prename'].$result_person['name']." ".$result_person['surname'];
$grant_position =$result_person['position_name'];

$pdf->SetFont('thsarabunnew', 'U', 14,'', 'false');
$pdf->SetFont('thsarabunnew', 'B', 14,'', 'false');
$pdf->MultiCell(200, 7,'คำสั่ง', 0,'L', 0, 1, 106, 238);
$pdf->SetFont('thsarabunnew', 'B', 14,'', 'false');
$pdf->MultiCell(200, 7,'อนุญาต           ไม่อนุญาต', 0,'L', 0, 1, 130, 238);

$commander_grant = $list_la_main['commander_grant'];
if($commander_grant == '1'){
$pdf->Image('images/box-yes.png', 125, 239, 4, 4);
$pdf->Image('images/box-null.png', 149, 239, 4, 4);
}
if($commander_grant == '2'){
$pdf->Image('images/box-null.png', 125, 239, 4, 4);
$pdf->Image('images/box-yes.png', 149, 239, 4, 4);
}
if($commander_grant == ''){
$pdf->Image('images/box-null.png', 125, 239, 4, 4);
$pdf->Image('images/box-null.png', 149, 239, 4, 4);
}

$pdf->SetFont('thsarabunnew', '', 14,'', 'false');
//$pdf->MultiCell(200, 7,'ทราบ/ลงนามแล้ว', 0,'L', 0, 1, 106,201); //ตย.
$pdf->MultiCell(200, 7, $list_la_main['commander_comment'], 0,'L', 0, 1, 106,245);
$pdf->MultiCell(200, 7,'......................................................................................................', 0,'L', 0, 1, 106,246);
//$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 106, 204);

//ลายเซ็นต์
$commander_sign = $list_la_main['commander_sign'];
$commander_sign2 = "../../signature/"."$commander_sign".".png";
if($commander_sign > ''){
$pdf->Image($commander_sign2, 135, 253, 32, 0); //ตำแหน่งแนวนอน , แนวตั้ง , กว้าง , สูง ลายเซ็นต์
}
$pdf->MultiCell(200, 7,'ผู้อนุมัติ', 0,'L', 0, 1, 180, 267);
$pdf->MultiCell(200, 7,'(ลงชื่อ)...................................................................................', 0,'L', 0, 1, 106, 268);
$pdf->MultiCell(200, 7,$grant_name, 0,'L', 0, 1, 125,274);
//$pdf->MultiCell(200, 7,'นายวรรณชัย  บุสนาม', 0,'L', 0, 1, 125,221); //ตย.
$pdf->MultiCell(200, 7,'(....................................................................................................)', 0,'L', 0, 1, 106, 275);
$pdf->MultiCell(200, 7,$grant_position, 0,'L', 0, 1, 124,281);
//$pdf->MultiCell(200, 7,'ผู้อำนวยการสำนักงานเขตพื้นที่การศึกษา', 0,'L', 0, 1, 124,228); //ตย.
$pdf->MultiCell(200, 7,'ตำแหน่ง........................................................................................', 0,'L', 0, 1, 106, 282);

$grant_date=$list_la_main['grant_date'];
if($grant_date > ''){
list($y,$m,$d) = explode("-", $grant_date);
		$year = $y +543;
		$pdf->MultiCell(70, 7,intval($d).' '.$thmonth[$m].' '.$year, 0,'L', 0, 1, 124,287);
}
$pdf->MultiCell(200, 7,'วันที่..............................................................................................', 0,'L', 0, 1, 106, 288);

//จบผู้อนุมัติ


}
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->Image('images/krut.png', 20, 10, 20, 20); //ตำแหน่งแนวนอน , แนวตั้ง , กว้าง , สูง
		$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, 100, 20);
		$pdf->MultiCell(100, 7,$list_la_main['write_at'], 0,'L', 0, 1, 112, 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);

//ลายเซ็นต์
$person_id = $list_la_main['person_id'];
$signature = "../../signature/"."$person_id".".png";
$pdf->Image($signature, 130, 109, 30, 0); //ตำแหน่งแนวนอน , แนวตั้ง , กว้าง , สูง ลายเซ็นต์

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


//ผู้ตรวจสอบ
$sql_person = "SELECT
person_main.prename,
person_main.`name`,
person_main.surname,
person_position.position_name
FROM
person_main
INNER JOIN person_position ON person_main.position_code = person_position.position_code
WHERE
person_main.person_id = '$list_la_main[officer_sign]'";
$dbquery_person = mysqli_query($connect,$sql_person);
$result_person = mysqli_fetch_array($dbquery_person);
$officer_name =$result_person['prename'].$result_person['name']." ".$result_person['surname'];
$officer_position =$result_person['position_name'];
$pdf->MultiCell(200, 7, $list_la_main['officer_comment'], 0,'L', 0, 1, 20,142);
$pdf->MultiCell(200, 7,'.......................................................................................', 0,'L', 0, 1, 20,143);

//ลายเซ็นต์
$officer_sign = $list_la_main['officer_sign'];
$officer_sign2 = "../../signature/"."$officer_sign".".png";
if($officer_sign > ''){
$pdf->Image($officer_sign2, 50, 150, 30, 0); //ตำแหน่งแนวนอน , แนวตั้ง , กว้าง , สูง ลายเซ็นต์
}

$pdf->MultiCell(200, 7,'(ลงชื่อ)..........................................................ผู้ตรวจสอบ', 0,'L', 0, 1, 20,160);
$pdf->MultiCell(200, 7,$officer_name, 0,'L', 0, 1, 40,167);
//$pdf->MultiCell(200, 7,'นายสัมพันธ์  พันธ์พิมพ์', 0,'L', 0, 1, 40,162); //ตย.
$pdf->MultiCell(200, 7,'(......................................................................................)', 0,'L', 0, 1, 20, 168);
$pdf->MultiCell(200, 7,$officer_position, 0,'L', 0, 1, 40,174);
//$pdf->MultiCell(200, 7,'นักจัดการงานทั่วไป', 0,'L', 0, 1, 40,169); //ตย.
$pdf->MultiCell(200, 7,'ตำแหน่ง..........................................................................', 0,'L', 0, 1, 20, 175);

$officer_date=$list_la_main['officer_date'];
if($officer_date > ''){
list($y,$m,$d) = explode("-", $officer_date);
		$year = $y +543;
		$pdf->MultiCell(70, 7,intval($d).' '.$thmonth[$m].' '.$year, 0,'L', 0, 1, 40,181);
}
$pdf->MultiCell(200, 7,'วันที่................................................................................', 0,'L', 0, 1, 20, 182);
//จบผู้ตรวจสอบ


//ผู้บังคับบัญชาต้น ผอ.กลุ่ม
$sql_person = "SELECT
person_main.prename,
person_main.`name`,
person_main.surname,
person_position.position_name
FROM
person_main
INNER JOIN person_position ON person_main.position_code = person_position.position_code
WHERE
person_main.person_id = '$list_la_main[group_sign]'";
$dbquery_person = mysqli_query($connect,$sql_person);
$result_person = mysqli_fetch_array($dbquery_person);
$fullname_group =$result_person['prename'].$result_person['name']." ".$result_person['surname'];
$position_group =$result_person['position_name'];

$pdf->MultiCell(200, 7,'ความเห็นของผู้บังคับบัญชาขั้นต้น (ผอ.กลุ่ม)', 0,'L', 0, 1, 106, 142);
//$pdf->MultiCell(200, 7,'เห็นควรอนุมัติ', 0,'L', 0, 1, 106,149); //ตย.
$pdf->MultiCell(200, 7, $list_la_main['group_comment'], 0,'L', 0, 1, 106,148);
$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 106,149);
//$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 106, 204);

//ลายเซ็นต์
$group_sign = $list_la_main['group_sign'];
$group_sign2 = "../../signature/"."$group_sign".".png";
if($group_sign > ''){
$pdf->Image($group_sign2, 135, 155, 30, 0); //ตำแหน่งแนวนอน , แนวตั้ง , กว้าง , สูง ลายเซ็นต์
}

$pdf->MultiCell(200, 7,'(ลงชื่อ).............................................................................', 0,'L', 0, 1, 106, 168);
$pdf->MultiCell(200, 7,$fullname_group, 0,'L', 0, 1, 125,174);
//$pdf->MultiCell(200, 7,'นางอิสรีย์  ปิติฤทธิ์', 0,'L', 0, 1, 125,169); //ตย.
$pdf->MultiCell(200, 7,'(......................................................................................)', 0,'L', 0, 1, 106, 175);
$pdf->MultiCell(200, 7,$position_group, 0,'L', 0, 1, 121,182);
//$pdf->MultiCell(200, 7,'ผู้อำนวยการกลุ่มอำนวยการ', 0,'L', 0, 1, 124,176); //ตย.
$pdf->MultiCell(200, 7,'ตำแหน่ง..........................................................................', 0,'L', 0, 1, 106, 183);

$group_date=$list_la_main['group_date'];
if($group_date > ''){
list($y,$m,$d) = explode("-", $group_date);
		$year = $y +543;
		$pdf->MultiCell(70, 7,intval($d).' '.$thmonth[$m].' '.$year, 0,'L', 0, 1, 124,189);
}
$pdf->MultiCell(200, 7,'วันที่.................................................................................', 0,'L', 0, 1, 106, 190);

//จบผู้บังคับบัญชาต้น ผอ.กลุ่ม


//จบผู้บังคับบัญชาต้น รอง.ผอ.
$sql_person = "SELECT
person_main.prename,
person_main.`name`,
person_main.surname,
person_position.position_name
FROM
person_main
INNER JOIN person_position ON person_main.position_code = person_position.position_code
WHERE
person_main.person_id = '$list_la_main[group_sign2]'";
$dbquery_person = mysqli_query($connect,$sql_person);
$result_person = mysqli_fetch_array($dbquery_person);
$group_name2 =$result_person['prename'].$result_person['name']." ".$result_person['surname'];
$group_position2 =$result_person['position_name'];
$pdf->SetFont('thsarabunnew', '', 16,'', 'false');
//$pdf->MultiCell(200, 7,'เห็นควรอนุมัติ', 0,'L', 0, 1, 106,201); //ตย.
$pdf->MultiCell(200, 7, $list_la_main['group_comment2'], 0,'L', 0, 1, 20,215);
$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 20,216);
//$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 20, 202);

//ลายเซ็นต์
$group_sign2 = $list_la_main['group_sign2'];
$group_sign22 = "../../signature/"."$group_sign2".".png";
if($group_sign2 > ''){
$pdf->Image($group_sign22, 40, 227, 25, 0); //ตำแหน่งแนวนอน , แนวตั้ง , กว้าง , สูง ลายเซ็นต์
}

$pdf->MultiCell(200, 7,'(ลงชื่อ).............................................................................', 0,'L', 0, 1, 20, 238);
$pdf->MultiCell(200, 7,$group_name2, 0,'L', 0, 1, 40,245);
//$pdf->MultiCell(200, 7,'นายรุ่งอรุณ  ป้องกัน', 0,'L', 0, 1, 40,221); //ตย.
$pdf->MultiCell(200, 7,'(......................................................................................)', 0,'L', 0, 1, 20, 246);
$pdf->MultiCell(200, 7,$group_position2, 0,'L', 0, 1, 40,254);
//$pdf->MultiCell(200, 7,'รองผู้อำนวยการสำนักงานเขตพื้นที่การศึกษา', 0,'L', 0, 1, 124,228); //ตย.
$pdf->MultiCell(200, 7,'ตำแหน่ง..........................................................................', 0,'L', 0, 1, 20, 255);

$group_date2=$list_la_main['group_date2'];
if($group_date2 > ''){
list($y,$m,$d) = explode("-", $group_date2);
		$year = $y +543;
		$pdf->MultiCell(70, 7,intval($d).' '.$thmonth[$m].' '.$year, 0,'L', 0, 1, 40,262);
}
$pdf->MultiCell(200, 7,'วันที่.................................................................................', 0,'L', 0, 1, 20, 263);
//จบผู้บังคับบัญชาต้น รอง.ผอ.


//ผู้อนุมัติ
$sql_person = "SELECT
person_main.prename,
person_main.`name`,
person_main.surname,
person_position.position_name
FROM
person_main
INNER JOIN person_position ON person_main.position_code = person_position.position_code
WHERE
person_main.person_id = '$list_la_main[commander_sign]'";
$dbquery_person = mysqli_query($connect,$sql_person);
$result_person = mysqli_fetch_array($dbquery_person);
$grant_name =$result_person['prename'].$result_person['name']." ".$result_person['surname'];
$grant_position =$result_person['position_name'];

$pdf->SetFont('thsarabunnew', 'U', 16,'', 'false');
$pdf->MultiCell(200, 7,'คำสั่ง', 0,'L', 0, 1, 106, 200);
$pdf->SetFont('thsarabunnew', 'B', 16,'', 'false');
$pdf->MultiCell(200, 7,'อนุญาต           ไม่อนุญาต', 0,'L', 0, 1, 130, 207);

$commander_grant = $list_la_main['commander_grant'];
if($commander_grant == '1'){
$pdf->Image('images/box-yes.png', 125, 208, 4, 4);
$pdf->Image('images/box-null.png', 149, 208, 4, 4);
}
if($commander_grant == '2'){
$pdf->Image('images/box-null.png', 125, 208, 4, 4);
$pdf->Image('images/box-yes.png', 149, 208, 4, 4);
}
if($commander_grant == ''){
$pdf->Image('images/box-null.png', 125, 208, 4, 4);
$pdf->Image('images/box-null.png', 149, 208, 4, 4);
}

$pdf->SetFont('thsarabunnew', '', 16,'', 'false');
//$pdf->MultiCell(200, 7,'ทราบ/ลงนามแล้ว', 0,'L', 0, 1, 106,201); //ตย.
$pdf->MultiCell(200, 7, $list_la_main['commander_comment'], 0,'L', 0, 1, 106,215);
$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 106,216);
//$pdf->MultiCell(200, 7,'........................................................................................', 0,'L', 0, 1, 106, 204);

//ลายเซ็นต์
$commander_sign = $list_la_main['commander_sign'];
$commander_sign2 = "../../signature/"."$commander_sign".".png";
if($commander_sign > ''){
$pdf->Image($commander_sign2, 135, 227, 35, 0); //ตำแหน่งแนวนอน , แนวตั้ง , กว้าง , สูง ลายเซ็นต์
}

$pdf->MultiCell(200, 7,'(ลงชื่อ).............................................................................', 0,'L', 0, 1, 106, 238);
$pdf->MultiCell(200, 7,$grant_name, 0,'L', 0, 1, 125,245);
//$pdf->MultiCell(200, 7,'นายวรรณชัย  บุสนาม', 0,'L', 0, 1, 125,221); //ตย.
$pdf->MultiCell(200, 7,'(......................................................................................)', 0,'L', 0, 1, 106, 246);
$pdf->MultiCell(200, 7,$grant_position, 0,'L', 0, 1, 124,254);
//$pdf->MultiCell(200, 7,'ผู้อำนวยการสำนักงานเขตพื้นที่การศึกษา', 0,'L', 0, 1, 124,228); //ตย.
$pdf->MultiCell(200, 7,'ตำแหน่ง..........................................................................', 0,'L', 0, 1, 106, 255);

$grant_date=$list_la_main['grant_date'];
if($grant_date > ''){
list($y,$m,$d) = explode("-", $grant_date);
		$year = $y +543;
		$pdf->MultiCell(70, 7,intval($d).' '.$thmonth[$m].' '.$year, 0,'L', 0, 1, 124,262);
}
$pdf->MultiCell(200, 7,'วันที่.................................................................................', 0,'L', 0, 1, 106, 263);
$pdf->MultiCell(200, 7,'ผู้อนุมัติ', 0,'L', 0, 1, 140, 270);
//จบผู้อนุมัติ



$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['la_total'], 0,'C', 0, 1, 50, 130);
$pdf->MultiCell(15, 7,$list_la_main['la_total']+$list_la_main['relax_ago'], 0,'C', 0, 1, 74, 130);
//$pdf->MultiCell(15, 7,$list_la_main['relax_this'].$list_la_main['la_total'], 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
//============================================================+