MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /var/www/html/pathumthani_eoffice/application/ecomplain/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/pathumthani_eoffice/application/ecomplain/view_pdf_bk20091015.php
<?php
#START
#This Program is copyrigth by Sapphire R&D co.,ltd
#TableMaster=tbl_complain
#TableValue=tbl_complain_approve
#KeyinCode=
#DateModified= 4-06-2009   
#ModifyBy=Kridsada
#END
ob_start();
session_start();
define('FPDF_FONTPATH','fpdf/font/');
include "../../config/config.inc.php";
require('fpdf/fpdf.php');
require('pdf_class.php');

$monthname = array( "","มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน", "กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
$monthsname = array( "","ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.", "ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
$mm_now = date("n");
$date_now = date("j");
$year_now = (date("Y")+543);


// ฟังชั่นก์ แสดงผล วัน เดือน ปี ไทย
function  showthaidate($number){

$digit=array('ศูนย์','หนึ่ง','สอง','สาม','สี่','ห้า','หก','เจ็ด','แปด','เก้า','สิบ');
$num=array('','สิบ','ร้อย','พัน','หมื่น','แสน','ล้าน');
$number = explode(".",$number);
$c_num[0]=$len=strlen($number[0]);
$c_num[1]=$len2=strlen($number[1]);
$convert='';
if($len > 2){
	$a1 = $len - 1 ;
	$f_digit = substr($number[0],$a1,1);
}
//คิดจำนวนเต็ม
for($n=0;$n< $len;$n++){
	$c_num[0]--;
	$c_digit=substr($number[0],$n,1);
	if($c_num[0]==0&& $c_digit==0)$digit[$c_digit]='';

	if($len>1 && $len <= 2){
		if($c_num[0]==0&& $c_digit==1)$digit[$c_digit]='เอ็ด';
	}else if ($len>3){
		if($f_digit == 0){
			if($c_num[0]==0&& $c_digit==1)$digit[$c_digit]='หนึ่ง';
		}else{
			if($c_num[0]==0&& $c_digit==1)$digit[$c_digit]='เอ็ด';
		}
	}else{
		if($c_num[0]==0&& $c_digit==1)$digit[$c_digit]='หนึ่ง';
	}

	if($c_num[0]==0&& $c_digit==2)$digit[$c_digit]='สอง';
	if($c_num[0]==1&& $c_digit==0)$digit[$c_digit]='';
	if($c_num[0]==1&& $c_digit==1)$digit[$c_digit]='';
	if($c_num[0]==1&& $c_digit==2)$digit[$c_digit]='ยี่'; 

	$convert.=$digit[$c_digit];
		if($c_num[0] > 0 && $c_digit != 0 && $c_digit != ""){
			$convert.=$num[$c_num[0]]; 
		}
}
$convert .= "";
if($number[1]==''){$convert .= "";}

//คิดจุดทศนิยม
for($n=0;$n< $len2;$n++){ 
$c_num[1]--;
$c_digit=substr($number[1],$n,1);
if($c_num[1]==0&& $c_digit==1)$digit[$c_digit]='หนึ่ง';
if($c_num[1]==0&& $c_digit==2)$digit[$c_digit]='สอง';
if($c_num[1]==1&& $c_digit==2)$digit[$c_digit]='สอง'; 
if($c_num[1]==1&& $c_digit==1)$digit[$c_digit]='';
$convert.=$digit[$c_digit];
$convert.=$num[$c_num[1]]; 
}
if($number[1]!='')$convert .= "";
return $convert;

}

// @input $coplain_id is a complain_id from  tbl_complain
//520606T190337
//520606T180546
//$coplain_id = "520616T135759";
$sqlc = "SELECT * FROM tbl_complain WHERE complain_id = '" .  $_GET[coplain_id] . "'";
//$sqlc = "SELECT tbl_complain.*, ccaa.ccName as province FROM tbl_complain inner join ccaa on tbl_complain.public_province = ccaa.ccDigi  WHERE complain_id = '" .  $coplain_id . "'";
$qrc= mysql_query($sqlc) or die(mysql_error());
$rsc = mysql_fetch_assoc($qrc);


//==============Initialization========================================================
$pdf=new KP7();
$pdf->AliasNbPages();
$pdf->AddThaiFonts();
$pdf->AddPage();
//================================================================================
//Header=========================================================================
$title = "แบบรับเรื่องราวร้องเรียน/ร้องทุกข์/ขอความช่วยเหลือ ของ ศูนย์ดำรงธรรมจังหวัดปทุมธานี";
$pdf->SetFont('Angsana New','B',14);
$pdf->SetXY(100,10);
$pdf->Cell(1,5,$title,0,0,'C');
$x_init = 5;
$y_init = 16;
$tpy_add_const = 6;
//วันที่==============================================================================
$pdf->SetFont('Angsana New','',14);
$y = $y_init + 1;
$pdf->SetXY(200,$y);
$pdf->Cell(0,5,"เขียนที่ ". $rsc[public_writen],0,0,'R');
$y = $y+$tpy_add_const;
//label date
$pdf->SetXY($x_init+95,$y);
$pdf->Cell(0,5,"วันที่",0,0,'L');
$pdf->SetXY($x_init+108,$y);
$pdf->Cell(0,5,"เดือน",0,0,'L');
$pdf->SetXY($x_init+133,$y);
$pdf->Cell(0,5,"พ.ศ.",0,0,'L');
$pdf->SetXY($x_init+150,$y);
$pdf->Cell(0,5,"เวลา",0,0,'L');
$pdf->SetXY($x_init+170,$y);
$pdf->Cell(0,5,"น.",0,0,'L');

//date
$time = explode(" ", $rsc['keyin_time']);
$date_exp = explode("-", $rsc['keyin_time']);
$pdf->SetXY($x_init+157,$y);
$pdf->Cell(0,5,$time[1],0,0,'L');
if($date_exp[0] > 0){
	$day =  intval($date_exp[2]) ;
	$month = $monthname[(int)$date_exp[1]];
	$year = (int)$date_exp[0] +543;
}else{
	$day = intval(date("d"));
	$month = $monthname[intval(date("m"))];
	$year =  (date("Y")+543);
}

$pdf->SetXY($x_init+103,$y);
$pdf->Cell(0,5,$day,0,0,'L');
$pdf->SetXY($x_init+117,$y);
$pdf->Cell(0,5,$month,0,0,'L');
$pdf->SetXY($x_init+141,$y);
$pdf->Cell(0,5,$year,0,0,'L');
//$pdf->SetXY($x_init+160,$y);
//$pdf->Cell(0,5,"เวลา",0,0,'L');
//border
$pdf->SetXY($x_init,$y_init);
$pdf->Cell(200,13,'',1,0,'C');
$tp_y = $y_init + 13;
//==================================================================================
//กลุ่มเรื่องร้องเรียน=======================================================================
$y = $tp_y + 1;
$pdf->SetXY($x_init+1,$y);
$pdf->Cell(0,5,"ข้อมูลผู้ร้องเรียน (กรณีร้องเรียนด้วยตนเอง)",0,0,'L');
$y +=  $tpy_add_const;
$name = $rsc[public_name];
$age =  $rsc[public_age];
$job = $rsc[public_job];
$name_age = "ชื่อ-สกุล ....................................................................................  อายุ.................ปี  อาชีพ.........................................................................................";
$pdf->SetXY($x_init+10,$y);
$pdf->Cell(0,5,$name_age,0,0,'L');
// ชื่อ อายุ อาชีพ ผู้ร้องเรียน
$pdf->SetXY($x_init+45,$y-1);
$pdf->Cell(strlen($name),5,$name,0,0,'C');
$pdf->SetXY($x_init+103,$y-1);
$pdf->Cell(strlen($age),5,$age,0,0,'C');
$pdf->SetXY($x_init+150,$y-1);
$pdf->Cell(strlen($job),5,$job,0,0,'C');
$y +=  $tpy_add_const;
//ที่อยู่
$no =$rsc[public_address];
$moo = $rsc[public_moo];
$tambol = $rsc[public_tambol];
$amphur = $rsc[public_amphur];
if($rsc[public_province]){
	$sql_province=" SELECT ccaa.ccName FROM ccaa WHERE  ccaa.ccDigi ='$rsc[public_province]' limit 1";
	$rs_province=@mysql_query($sql_province);
	$rs_pro=@mysql_fetch_assoc($rs_province);
}
$province =$rs_pro[ccName];
$zipcode = $rsc[public_zipcode];
$address = "ที่อยู่.............หมู่ที่.......ตำบล....................................อำเภอ........................................จังหวัด........................................รหัสไปรษณีย์........................" ;
$pdf->SetXY($x_init+10,$y);
$pdf->Cell(0,5,$address,0,0,'L');
$pdf->SetXY($x_init+19,$y-1);
$pdf->Cell(strlen($no),5,$no,0,0,'C');
$pdf->SetXY($x_init+35,$y-1);
$pdf->Cell(strlen($moo),5,$moo,0,0,'C');
$pdf->SetXY($x_init+60,$y-1);
$pdf->Cell(strlen($tambol),5,$tambol,0,0,'C');
$pdf->SetXY($x_init+96,$y-1);
$pdf->Cell(strlen($amphur),5,$amphur,0,0,'C');
$pdf->SetXY($x_init+134,$y-1);
$pdf->Cell(strlen($province),5,$province,0,0,'C');
$pdf->SetXY($x_init+183,$y-1);
$pdf->Cell(strlen($zipcode),5,$zipcode,0,0,'C');
$y +=  $tpy_add_const;
//โทรศัพท์ อีเมล์
$phone = $rsc[public_phone];
$email = $rsc[public_email];
$contact =  "หมายเลขโทรศัพท์ที่สามารถติดต่อได้....................................................... E-mail (ถ้ามี) .........................................................................................";
$pdf->SetXY($x_init+10,$y);
$pdf->Cell(0,5,$contact,0,0,'L');
$pdf->SetXY($x_init+79,$y-1);
$pdf->Cell(strlen($phone),5,$phone,0,0,'C');
$pdf->SetXY($x_init+152,$y-1);
$pdf->Cell(strlen($email),5,$email,0,0,'C');
$y +=  $tpy_add_const;
//feedback
$ch1 = ($rsc[feedback] == 1)? '/' : "";
$ch2 = ($rsc[feedback] == 0)? '/' : "";
$pdf->SetXY($x_init+10,$y);
$pdf->Cell(0,5,"การแจ้งผลการดำเนินการ",0,0,'L');
$pdf->SetXY($x_init+47,$y+1);
$pdf->Cell(3,3,$ch1,1,0,'C');
$pdf->SetXY($x_init+50,$y);
$pdf->Cell(0,5,"ต้องการให้แจ้งผลการดำเนินการ",0,0,'L');
$pdf->SetXY($x_init+97,$y+1);
$pdf->Cell(3,3,$ch2,1,0,'C');
$pdf->SetXY($x_init+100,$y);
$pdf->Cell(0,5,"ไม่ต้องการให้แจ้งผลการดำเนินการ",0,0,'L');
//checker feedback
if($rsc[feedback]  == 1)
{
	$pdf->SetXY($x_init+47,$y+1);
	$pdf->Cell(3,3,'/',0,0,'C');
}else if($rsc[feedback]  == 0)
{
	
}
$y += $tpy_add_const;
//border
$y += 1;
$pdf->SetXY($x_init,$tp_y);
$pdf->Cell(200,$y - $tp_y+2,'',1,0,'C');
$tp_y = $y+2;
//==================================================================================
//กลุ่มเรื่องร้องเรียน=======================================================================
$y = $tp_y + 1;
$pdf->SetXY($x_init+1,$y);
$pdf->Cell(0,5,"รายละเอียดเรื่องที่ร้องเรียน",0,0,'L');
$y += $tpy_add_const;
$pdf->SetXY($x_init+10,$y);
$pdf->Cell(0,5,"ข้าพเจ้าฯ ขอร้องเรียน  ดังต่อไปนี้  ",0,0,'L');
// type problem
$sql_tp = "SELECT * FROM tbl_type_problem ";
$qr_tp = mysql_query($sql_tp) or die(mysql_error());
$x = 65;
while($rss_tp= mysql_fetch_assoc($qr_tp))
{
	$ch = "";
	if($rss_tp[type_id] == $rsc[type_problem])
	{
		$ch = '/';
	}
	$length = strlen($rss_tp[s_name]);
	if(($x + $length) > 200)
	{
		$x = $x_init+5;
		$y += $tpy_add_const;
	}
	$pdf->SetXY($x-3,$y+1);
	$pdf->Cell(3,3,$ch,1,0,'C');
	$pdf->SetXY($x,$y);
	$pdf->Cell($length,5,$rss_tp[s_name] ,0,0,'L');
	$x +=  $length*2;
}
$y += $tpy_add_const;
//เรื่องอื่นๆ
$dot =  "...................................................................................................................................................................................................................................";
$pdf->SetXY($x_init+10,$y);
$pdf->Cell(0,5,$dot,0,0,'L');

$pdf->SetXY($x_init+10,$y-1);
$pdf->Cell(0,5,$rsc[problem_comment] ,0,0,'L');
$y += $tpy_add_const;
$temp_y = $y+1;
$dot =  "........................................................................................................................................................................................................";
$pdf->SetXY($x_init+32,$temp_y);
$pdf->Cell(0,5,$dot,0,0,'L');
//dot only
$temp_y += $tpy_add_const;
$dot =  "..............................................................................................................................................................................................................................................";
for($i = 0 ; $i < 12 ; $i++)
{
	$pdf->SetXY($x_init+1,$temp_y);
	$pdf->Cell(0,5,$dot,0,0,'L');
	$temp_y += $tpy_add_const;
}
//detail
$detail = "           เนื่องด้วยข้าพเจ้า " . $rsc[complain_detail];
$arr_str= $pdf->alignstr($detail,138);	
$num_str = count($arr_str);
$i = 0;
while($i < $num_str )
{
	$pdf->SetXY($x_init+1,$y);
	$pdf->Cell(0,5,$arr_str[$i],0,0,'L');
	$y += $tpy_add_const;
	$i++;
}
$y = $temp_y +2;
$pdf->SetXY($x_init+10,$y);
$pdf->Cell(0,5,"จึงขอได้โปรด  ",0,0,'L');
// type problem
$sql_pc = "SELECT * FROM tbl_type_process ";
$qr_pc = mysql_query($sql_pc) or die(mysql_error());
$x = 40;
while($rss_pc= mysql_fetch_assoc($qr_pc))
{
	$ch = "";
	if($rss_pc[type_id]== $rsc[type_process])
	{
		$ch = '/';
	}
	$length = strlen($rss_pc[s_name]);
	if(($x + $length) > 200)
	{
		$x = $x_init+5;
		$y += $tpy_add_const;;
	}
	$pdf->SetXY($x-3,$y+1);
	$pdf->Cell(3,3,$ch,1,0,'C');
	$pdf->SetXY($x,$y);
	$pdf->Cell($length,5,$rss_pc[s_name] ,0,0,'L');
	$x +=  $length*2;
}
$y += $tpy_add_const;
// dot only
$temp_y = $y+1;
$dot =  "...................................................................................................................................................................................................................................";
$pdf->SetXY($x_init+10,$temp_y);
$pdf->Cell(0,5,$dot,0,0,'L');
$temp_y += $tpy_add_const;
$dot =  "..............................................................................................................................................................................................................................................";
for($i = 0 ; $i < 5 ; $i++)
{
	$pdf->SetXY($x_init+1,$temp_y);
	$pdf->Cell(0,5,$dot,0,0,'L');
	$temp_y += $tpy_add_const;
}
$dot =  ".................................................................................................................................................................................................ให้แก่ข้าพเจ้าฯต่อไปด้วย";
$pdf->SetXY($x_init+1,$temp_y);
$pdf->Cell(0,5,$dot,0,0,'L');
//process comment
$comment = "           " .$rsc[process_comment];
$arr_str= $pdf->alignstr($comment,138);	
$num_str = count($arr_str);
$i = 0;
while($i < $num_str )
{
	$pdf->SetXY($x_init+1,$y);
	$pdf->Cell(0,5,$arr_str[$i],0,0,'L');
	$y += $tpy_add_const;
	$i++;
}
//ท้ายกรอบ
$y =  $temp_y + $tpy_add_const + 2;
$pdf->SetXY($x_init+10,$y);
$pdf->Cell(0,5,"ข้าพเจ้าฯ ขอรับรองว่า ข้อความดังกล่าวข้างต้นเป็นความจริงทุกประการ",0,0,'L');
$y += $tpy_add_const;
$y += 1;
//border
$pdf->SetXY($x_init,$tp_y);
$pdf->Cell(200,$y - $tp_y+2,'',1,0,'C');
$tp_y = $y+2;
$y += $tpy_add_const *2;
//ลงชื่อ
$pdf->SetXY($x_init+90,$y);
$pdf->Cell(0,5,"(ลงชื่อ) .......................................................................... /ผู้ร้อง",0,0,'C');
$y += $tpy_add_const + 2;
$pdf->SetXY($x_init+90,$y);
$pdf->Cell(0,5,"(..........................................................................)" ,0,0,'C');
$pdf->SetXY($x_init+90,$y-1);
$pdf->Cell(0,5,$rsc[public_name] ,0,0,'C');

//หมายเหตุ
$y += $tpy_add_const*2;
//check box
$pdf->SetXY($x_init +61,$y+1);
$pdf->Cell(3,3,'',1,0,'C');
//ท้ายกระดาษ
$foot = "หมายเหตุ : กรุณาใส่เครื่องหมาย / ลงในช่อง       และแนบสำเนาบัตรประจำตัวประชาชนทุกครั้งที่มีการร้องเรียน  เพื่อความสะดวกรวดเร็วในการดำเนินการกรุณากรอกข้อมูลให้ครบและชัดเจน";
$arr_str= $pdf->alignstr($foot,130);	
$num_str = count($arr_str);
$i = 0;
while($i < $num_str )
{
	if($i < 1)
	{
		$pdf->SetXY($x_init+1,$y);
	}else
	{
		$pdf->SetXY($x_init+15,$y);
	}
	$pdf->Cell(0,5,$arr_str[$i],0,0,'L');
	$y += $tpy_add_const;
	$i++;
}

$pdf->Output("$coplain_id.pdf",'D');
		
?>

Anon7 - 2021