| Server IP : 61.19.30.66 / Your IP : 216.73.216.80 Web Server : Apache/2.2.22 (Ubuntu) System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 User : www-data ( 33) PHP Version : 5.3.10-1ubuntu3.48 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/pension/ |
Upload File : |
<?php
// require('thaipdfclass.php');
include("./xpdfclass.php");
$level = 4; // 4 = 3, 6 = 5;
// $tpy = 1; // 1 = กบข./กสจ. 2 = เงินประกันสังคม
function PrintCenter($txt, $x, $w) {
global $pdf;
$ll = $w / 2;
$ww = $pdf->GetStringWidth($txt) / 2;
$pdf->Text($x + ($ll - $ww), $pdf->GetY(), $txt);
}
function u2t($string) {
global $th;
$str = $string;
if ($th != "UTF-8")
$res = $str;
else {
$res = "";
for ($i = 0; $i < strlen($str); $i++) {
if (ord($str[$i]) == 224) {
$unicode = ord($str[$i+2]) & 0x3F;
$unicode |= (ord($str[$i+1]) & 0x3F) << 6;
$unicode |= (ord($str[$i]) & 0x0F) << 12;
$res .= chr($unicode-0x0E00+0xA0);
$i += 2;
} else {
$res .= $str[$i];
}
}
}
return $res;
}
function t2u($tis) {
global $th;
if ($th != "UTF-8") {
for( $i=0 ; $i< strlen($tis) ; $i++ ){
$s = substr($tis, $i, 1);
$val = ord($s);
if( $val < 0x80 ){
$utf8 .= $s;
}
elseif ((0xA1 <= $val and $val <= 0xDA) or (0xDF <= $val and $val <= 0xFB)) {
$unicode = 0x0E00 + $val - 0xA0;
$utf8 .= chr( 0xE0 | ($unicode >> 12) );
$utf8 .= chr( 0x80 | (($unicode >> 6) & 0x3F) );
$utf8 .= chr( 0x80 | ($unicode & 0x3F) );
}
}
} else
$utf8 = $tis;
return $utf8;
}
function AThaiDate($fix) {
$ThaiMonth = array("มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม");
if (file_exists($fix))
$dd = date("Y-m-d H:i:s", filectime($fix));
else
$dd = date("Y-m-d H:i:s");
$bd = (int) substr($dd, 0, 4);
$bd = $bd + 543;
$dx = (string) $bd;
$dx = $dx.substr($dd, 4, 15);
$Year = substr($dx, 0, 4);
$Month = substr($dx, 5, 2);
$DayNo = substr($dx, 8, 2);
SetType($Month, "integer");
$Month--;
$rs = $DayNo." เดือน ".$ThaiMonth[$Month]." พ.ศ. ".$Year;
return $rs;
}
$fd = $_GET["fd"];
$fi = $_GET["fi"];
$id = $_GET["id"];
$th = $_GET["th"];
if ($th == "") $th = "tis-620";
//$tpy = $_GET["tpy"];
if (!isset($op)) $op = 0;
$pdf=new ThaiPDF();
$pdf->CreateThaiPDF();
$pdf->SetThaiFont();
// $pdf->SetHeader('' , 1, 'R', 1);
// $pdf->SetFooter('by : http://'.$SERVER_NAME." [".GetThaiDate()."]", 0, 'R', 1);
$pdf->SetTextColor(0,0,0);
$lef = $pdf->lMargin;
$rig = $pdf->w - $pdf->rMargin;
$tlef = $lef + 3;
$cmd = "none";
$fx = $fd."tax".$fi.".tax";
$fx1 = $fx;
if (file_exists($fx)) {
$data = file($fx);
$i = 0;
$chk = 0;
while (($i < count($data)) && ($chk == 0)) {
$dd = $data[$i];
$arr = explode("|", $dd);
if ($id == $arr[5]) {
$chk = 1;
$cmd = "show";
}
$i++;
}
}
$pdf->AddPage();
$pdf->SetFont("AngsanaNew", "B", 16);
if ($cmd == "show") {
$pdf->Cell(0, 0, "หนังสือรับรองการหักภาษี ณ ที่จ่าย", 0, 1, "C");
$pdf->Ln(6);
$pdf->SetFont("AngsanaNew", "", 14);
$pdf->Cell(0, 0, "ตามมาตรา 50 ทวิ แห่งประมวลรัษฎากร", 0, 1, "C");
$pdf->Ln(6);
$pdf->Cell(0, 0, "ฉบับที่ 1 (สำหรับผู้ถูกหักภาษี ณ ที่จ่าย ให้แนบพร้อมกับแบบแสดงรายการภาษี)", 0, 1, "C");
$pdf->Ln(5);
$pdf->Cell(0, 0, "เล่มที่......................", 0, 1, "L");
$pdf->Cell(0, 0, "เลขที่ ".$arr[0], 0, 1, "R");
$pdf->Ln(3);
$ttp = $pdf->GetY();
$pdf->Line($lef, $ttp, $rig, $ttp);
$pdf->Ln(6);
$pdf->Text($tlef, $pdf->GetY(), "ผู้มีหน้าที่หักภาษี ณ ที่จ่าย");
$pdf->Cell(0, 0, "เลขประจำตัวผู้เสียภาษีอากร", 0, 1, "R");
$pdf->Ln(6);
$pdf->SetFont("AngsanaNew", "B", 14);
$pdf->Text($tlef, $pdf->GetY(), "ชื่อ ".$arr[3]);
$pdf->Cell(0, 0, $arr[2], 0, 1, "R");
$pdf->SetFont("AngsanaNew", "", 14);
$pdf->Ln(6);
$pdf->Text($tlef, $pdf->GetY(), "ที่อยู่ ".$arr[4]);
$pdf->Ln(2);
$pdf->Line($lef, $pdf->GetY(), $rig, $pdf->GetY());
$pdf->Ln(6);
$pdf->Text($tlef, $pdf->GetY(), "ผู้ถูกหักภาษี ณ ที่จ่าย");
$pdf->Cell(0, 0, "เลขประจำตัวประชาชน", 0, 1, "R");
$pdf->Ln(6);
$pdf->SetFont("AngsanaNew", "B", 14);
$pdf->Text($tlef, $pdf->GetY(), "ชื่อ ".$arr[6]);
$pdf->Cell(0, 0, $arr[5], 0, 1, "R");
$pdf->SetFont("AngsanaNew", "", 14);
$pdf->Ln(6);
$pdf->Text($tlef, $pdf->GetY(), "ที่อยู่ ".$arr[7]);
$pdf->Ln(8);
$pdf->Text($tlef, $pdf->GetY(), "ลำดับที่.............................ในแบบ");
$pdf->Text($tlef + 50, $pdf->GetY(), "[ ] (1) ภ.ง.ด. 1 ก");
$pdf->Text($tlef + 87, $pdf->GetY(), "[ X ] (2) ภ.ง.ด. 1 ก พิเศษ");
$pdf->Text($tlef + 124, $pdf->GetY(), "[ ] (3) ภ.ง.ด. 2");
$pdf->Text($tlef + 161, $pdf->GetY(), "[ ] (4) ภ.ง.ด. 3");
$pdf->Text($tlef + 15, $pdf->GetY() - 1, $arr[0]);
$pdf->Ln(6);
$pdf->Text($tlef + 50, $pdf->GetY(), "[ ] (5) ภ.ง.ด. 2 ก");
$pdf->Text($tlef + 87, $pdf->GetY(), "[ ] (6) ภ.ง.ด. 3 ก");
$pdf->Text($tlef + 124, $pdf->GetY(), "[ ] (7) ภ.ง.ด. 53");
$pdf->Ln(2);
$pdf->Line($lef, $pdf->GetY(), $rig, $pdf->GetY());
$t2 = $pdf->GetY();
$pdf->Ln(6);
$pdf->SetFont("AngsanaNew", "B", 14);
$col = array(114, 25, 25, 25);
PrintCenter("ประเภทเงินที่จ่าย", $lef, $col[0]);
PrintCenter("วันเดือนหรือ", $col[0] + $lef, $col[1]);
PrintCenter("จำนวนเงินที่จ่าย", $lef + $col[0] + $col[1], $col[2]);
PrintCenter("ภาษีที่หัก", $col[0] + $col[1] + $col[2] + $lef, $col[3]);
$pdf->Ln(6);
PrintCenter("ปีภาษีที่จ่าย", $col[0] + $lef, $col[1]);
PrintCenter("และนำส่งไว้", $col[0] + $col[1] + $col[2] + $lef, $col[3]);
$pdf->SetFont("AngsanaNew", "", 14);
$pdf->Ln(2);
$pdf->Line($lef, $pdf->GetY(), $rig, $pdf->GetY());
$pdf->Ln(6);
$pdf->Text($tlef, $pdf->GetY(), "1. เงินเดือน ค่าจ้าง เบี้ยเลี้ยง โบนัส ฯลฯ ตามมาตรา 40(1)");
PrintCenter($arr[9], $lef + $col[0], $col[1]);
PrintCenter($arr[10], $lef + $col[0] + $col[1], $col[2]);
PrintCenter($arr[11], $lef + $col[0] + $col[1] + $col[2], $col[3]);
$pdf->Ln(6);
$pdf->Text($tlef, $pdf->GetY(), "2. ค่าธรรมเนียม ค่านายหน้า ฯลฯ ตามมาตรา 40(2)");
$pdf->Ln(6);
$pdf->Text($tlef, $pdf->GetY(), "3. ค่าแห่งลิขสิทธิ์ ฯลฯ ตามมาตรา 40(3)");
$pdf->Ln(6);
$pdf->Text($tlef, $pdf->GetY(), "4. (1) ค่าดอกเบี้ย ฯลฯ ตามมาตรา 40(4)");
$pdf->Ln(6);
$pdf->Text($tlef, $pdf->GetY(), " (2) เงินปันผล เงินส่วนแบ่งกำไร ฯลฯ ตามมาตรา 40(4)");
$pdf->Ln(8);
PrintCenter("ฯลฯ", $lef, $col[0]);
$pdf->Ln(8);
// if (count($arr) >= 14)
// $pdf->Text($tlef, $pdf->GetY(), "6. อื่น ๆ (ระบุ) กบข./กสจ. ".$arr[13]." บาท");
// else
$pdf->Text($tlef, $pdf->GetY(), "6. อื่น ๆ (ระบุ).........................................................................");
$pdf->Ln(3);
$pdf->Line($lef, $pdf->GetY(), $rig, $pdf->GetY());
$lll = $lef;
for ($i = 0; $i < 3; $i++) { $lll = $lll + $col[$i]; $pdf->Line($lll, $t2, $lll, $pdf->GetY()); }
$t2 = $pdf->GetY();
$pdf->Ln(6);
$pdf->SetFont("AngsanaNew", "B", 14);
PrintCenter("รวมเงินที่จ่ายและภาษีที่หักนำส่ง", $lef, $col[0]);
PrintCenter($arr[10], $lef + $col[0] + $col[1], $col[2]);
PrintCenter($arr[11], $lef + $col[0] + $col[1] + $col[2], $col[3]);
$pdf->SetFont("AngsanaNew", "", 14);
$pdf->Ln(2);
$lll = $lef + $col[0];
$pdf->Line($lll + $col[1], $pdf->GetY(), $rig, $pdf->GetY());
for ($i = 1; $i < 3; $i++) { $lll = $lll + $col[$i]; $pdf->Line($lll, $t2, $lll, $pdf->GetY()); }
$pdf->Ln(6);
$xxx = (int) ($arr[11]);
if ($xxx == 0)
$pdf->Text($tlef, $pdf->GetY(), "รวมเงินภาษีที่หักนำส่ง (ตัวอักษร) ---");
else
$pdf->Text($tlef, $pdf->GetY(), "รวมเงินภาษีที่หักนำส่ง (ตัวอักษร) =".$arr[12]."=");
$pdf->Ln(3);
$pdf->Line($lef, $pdf->GetY(), $rig, $pdf->GetY());
$pdf->Ln(6);
$pdf->Text($tlef, $pdf->GetY(), "เงินที่จ่ายเข้า กบข./กสจ./เงินกองทุนสงเคราะห์ครูเอกชน.......................................บาท เงินประกันสังคม.......................................บาท");
$tpy = 2;
if (count($arr) >= 14) {
if (count($arr) >= 15)
$tpy = (int) ($arr[14]);
if ($tpy == 1) $pdf->Text(100, $pdf->GetY() - 1, Trim($arr[13]));
if ($tpy == 2) $pdf->Text(160, $pdf->GetY() - 1, Trim($arr[13]));
}
$pdf->Ln(3);
$pdf->Line($lef, $pdf->GetY(), $rig, $pdf->GetY());
$pdf->Ln(6);
$pdf->Text($tlef, $pdf->GetY(), "ผู้จ่ายเงิน [ ] (1) ออกภาษีให้ครั้งเดียว [ ] (2) ออกภาษีให้ตลอดไป [ X ] (3) หัก ณ ที่จ่าย [ ] อื่น ๆ ระบุ");
$pdf->Ln(3);
$pdf->Line($lef, $pdf->GetY(), $rig, $pdf->GetY());
// $pdf->Ln(6);
// $pdf->Text(105, $pdf->GetY(), "เลขบัญชีนายจ้าง");
// $pdf->Text(135, $pdf->GetY(), "เลขที่บัตรประกันสังคมของผู้ถูกหักภาษี ณ ที่จ่าย");
// $pdf->Ln(6);
// $pdf->Text($tlef, $pdf->GetY(), "เงินสะสมเข้ากองทุนประกันสังคม..........................บาท");
// $pdf->Ln(6);
// $pdf->Text($tlef, $pdf->GetY(), "เงินสะสมจ่ายเข้ากองทุนสำรองเลี้ยงชีพ ใบอนุญาตเลขที่......................จำนวนเงิน.................................บาท");
// $pdf->Ln(3);
// $pdf->Line($lef, $pdf->GetY(), $rig, $pdf->GetY());
$pdf->Ln(6);
$pdf->Cell(0, 0, "ขอรับรองว่าข้อความและตัวเลขดังกล่าวข้างต้นถูกต้องตรงกับความจริงทุกประการ", 0, 1, "C");
$pdf->Ln(10);
$fn = "";
$fx = $fd."signal".$fi.".jpg";
if (file_exists($fx))
$fn = $fx;
else {
$fx = $fd."signal.JPG";
if (file_exists($fx))
$fn = $fx;
else {
$fx = $fd."signal.Jpg";
if (file_exists($fx))
$fn = $fx;
else {
$fx = $fd."signal.jpg";
if (file_exists($fx))
$fn = $fx;
}
}
}
$pdf->Ln(6);
$pdf->Text(($pdf->w / 2) - 10, $pdf->GetY(), "ลงชื่อ");
$pdf->Text(($pdf->w / 2) + 55, $pdf->GetY(), "ผู้มีหน้าที่หักภาษี ณ ที่จ่าย");
$pdf->Ln(-6);
if ($fn != "") {
$pdf->Image($fn, ($pdf->w / 2) - 2, $pdf->GetY() - 5, 55, 20, "jpg");
} else
$pdf->Ln(6);
$pdf->Ln(19);
if (count($arr) < 16) {
// $pdf->Text(($pdf->w / 2) + 5, $pdf->GetY(), "วันที่ ".AThaiDate($fx1)); // ของเดิม
// เพิ่มบรรทัดนี้
$fi = (int) ($fi + 1);
$pdf->Text(($pdf->w / 2) + 5, $pdf->GetY(), "วันที่ 15 กุมภาพันธ์ ".$fi); // แก้ไขเป็น
} else
$pdf->Text(($pdf->w / 2) + 5, $pdf->GetY(), "วันที่ ".$arr[15]);
$pdf->Ln(10);
// PHP7
//$pdf->Cell(0, 0, "from: http://".gethostname(), 0, 1, "C");
// PHP5
// $pdf->Cell(0, 0, "from: http://".$SERVER_NAME, 0, 1, "C");
$pdf->Ln(10);
$pdf->Line($lef, $pdf->GetY(), $rig, $pdf->GetY());
$pdf->Line($lef, $ttp, $lef, $pdf->GetY());
$pdf->Line($rig, $ttp, $rig, $pdf->GetY());
$pdf->Ln(6);
$pdf->Text($lef, $pdf->GetY(), "สามารถยื่นแบบ ภ.ง.ด. 91 ผ่านระบบอินเทอร์เน็ตได้ที่ http://www.rd.go.th");
}
$pdf->Output("tax".$fi.".pdf", "I");
?>