| 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/salary/ |
Upload File : |
<?php
function GenTxt($width) {
$txt = "abcdefghijklmnopqrstuvwxyz";
$word = "";
srand((double)microtime()*1000000);
for ($i=0; $i<$width; $i++)
$word .= $txt[rand()%strlen($txt)];
return $word;
}
function GenNum($width) {
$txt = "1234567890";
$num = "";
srand((double)microtime()*1000000);
for ($i=0; $i<$width; $i++)
$num .= $txt[rand()%strlen($txt)];
return $num;
}
function u2t($string) {
global $Thai_Code;
$res = "";
$str = $string;
if ($Thai_Code == "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 $Thai_Code;
$utf8 = "";
if ($Thai_Code == "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( 0xB8 | (($unicode >> 6) & 0x3F) );
$utf8 .= chr( 0x80 | ($unicode & 0x3F) );
}
}
} else
$utf8 = $tis;
return $utf8;
}
$cmd = "";
if (isset($_POST["cmd"])) $cmd = $_POST["cmd"];
if ($cmd == "") { if (isset($_GET["cmd"])) $cmd = $_GET["cmd"]; }
if ($cmd == "") $cmd = "none";
if ($cmd == "login") {
$usr = $_POST["usr"];
$psw = $_POST["psw"];
$mmt = $_POST["mmt"];
$yyr = $_POST["yyr"];
}
if ($cmd == "upload") {
$fil = $_FILES["fil"]["name"];
$tmp = $_FILES["fil"]["tmp_name"];
$MAX_FILE_SIZE = $_POST["MAX_FILE_SIZE"];
}
if ($cmd == "xdelx")
$fil = $_GET["fil"];
if ($cmd == "signal") {
$til = $_FILES["til"]["name"];
$tmp = $_FILES["til"]["tmp_name"];
$MAX_FILE_SIZE = $_POST["MAX_FILE_SIZE"];
$yax = $_POST["yax"];
}
// กรุณาแก้ไขข้อมูลบริเวณนี้ ให้สอดคล้องกับการใช้งานจริง
$adminuser = "admin";
$adminpassword = "admin12345678";
$company = "โรงเรียนกันทรลักษ์วิทยา สำนักงานเขตพื้นที่การศึกษามัธยมศึกษาศรีสะเกษ ยโสธร";
$address = "443 ม.5 ต.น้ำอ้อม อ.กันทรลักษ์ จ.ศรีสะเกษ 33110 ";
$types_slip = 1; // 1 = แสดงแบบครบทุกรายการ 2 = แสดงเฉพาะรายการที่จำนวนเงิน
$types_bank = 1; // 1 = แสดงเลขบัญชีธนาคาร 2 = ไม่แสดงเลขบัญชีธนาคาร
$app = "รายละเอียดบัญชีจ่ายเงินรายเดือนข้าราชการและลูกจ้างประจำ";
$folder = "./dataslip/"; // ชื่อโฟลเดอร์สำหรับเก็บข้อมูล ซึ่งต้องสร้างเป็นโฟลเดอร์ย่อยไว้ด้วย
$ThaiMonth = array("มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม");
// $Thai_Code = "tis-620"; // Standard Server (Linux and Window)
$Thai_Code = "UTF-8";
// $Thai_Code = "Windows-874"; // For Window Server
$File_Ext = ".upd"; // เงินเดือน
// $File_Ext = ".sdt"; // บำนาญ
$idform = GenTxt(10).GenNum(10);
$msg = "";
if ($cmd == "login") {
if (($usr == $adminuser) && ($psw == $adminpassword)) {
$cmd = "admin";
} else {
$fi = "d".$mmt.$yyr.$File_Ext;
if (file_exists($folder.$fi)) {
$data = file($folder.$fi);
$dd = $data[0];
$hdd = explode("|", $dd);
$hc = count($hdd) - 1;
// if ($hc == 54)
if (trim($hdd[$hc]) == "A")
$hfg = 1;
else
$hfg = 0;
$hhh = array("H", 11 + $hfg, 34);
$i = 1;
$chk = 0;
while (($i < count($data)) && ($chk == 0)) {
$dd = $data[$i];
$arr = explode("|", $dd);
if (($usr == $arr[1]) && ($psw == $arr[2])) {
$chk = 1;
$cmd = "show";
}
$i++;
}
if ($chk == 0) {
$cmd = "none";
$msg = "<font color=#ff0000>ไม่มีข้อมูลของผู้ใช้ที่กำหนดในแฟ้มข้อมูล</font>";
}
} else {
$cmd = "none";
$msg = "<font color=#ff0000>ไม่มีข้อมูลในเดือน ปี ที่กำหนด</font>";
}
}
}
if ($cmd == "upload") {
$msg = "<br><div align=\"center\"><b>";
if (move_uploaded_file($tmp, $folder.$fil))
$msg .= "Upload ข้อมูลเสร็จเรียบร้อยแล้ว คลิ๊กที่ปุ่ม "ยกเลิก" เพื่อกลับไปหน้าหลัก";
else
$msg .= "พบปัญหาในการอัพไฟล์ข้อมูล ไม่สามารถ Upload ได้";
$msg .= "</b></div>";
$cmd = "admin";
}
if ($cmd == "del") $cmd = "none";
if ($cmd == "xdelx") {
$cmd = "admin";
if (file_exists($folder.$fil)) {
unlink($folder.$fil);
}
}
if ($cmd == "signal") {
$msg = "<br><div align=\"center\"><b>";
$cmd = "admin";
$ext = $til;
while (strpos($ext, ".") != 0) {
$pst = strpos($ext, ".");
$len = strlen($ext);
$ext = substr($ext, $pst + 1, $len - $pst);
}
$flx = "signal".$yax.".".$ext;
if (move_uploaded_file($tmp, $folder.$flx))
$msg .= "Upload ไฟล์รูปภาพลายเซ็นต์เรียบร้อยแล้ว";
else
$msg .= "พบปัญหาในการ Upload ไฟล์ลายเซ็นต์ ไม่สามารถ Upload ได้";
$msg .= "</b></div>";
}
echo "<html>\n<head>\n\t<title>: : : ".t2u($app)." : : :</title>\n";
echo "\t<meta name=\"content-language\" content=\"th\">\n";
echo "\t<meta http-equiv=\"cache-control\" content=\"max-age=0\">\n";
echo "\t<meta http-equiv=\"cache-control\" content=\"no-cache\">\n";
echo "\t<meta http-equiv=\"imagetoolbar\" content=\"no\">\n";
echo "\t<meta http-equiv=\"pragma\" content=\"no-cache\">\n";
echo "\t<meta http-equiv=\"expires\" content=\"-1\">\n";
echo "\t<meta http-equiv=\"content-type\" content=\"text/html; charset=$Thai_Code\">\n";
echo "\t<style type=\"text/css\">\n";
echo "\t\t@font-face { font-family: extFont; src: url(\"./font/THSarabunNew.eot\"); }\n";
echo "\t\t@font-face { font-family: extFont; src: url(\"./font/THSarabunNew.ttf\"); }\n";
echo "\t\timg { border: none; }\n";
echo "\t\thtml, body { margin: 0; padding: 0; text-align: center; height: 100%; background: #e0e0e0; font-size: 18px; font-family: extFont; color: #0000a0; font-size: 13px; overflow: auto; }\n";
echo "\t\ttable { background-color: #ffffff; border-style: solid; border-color: #808080; border-width: 0pt; border-collapse: collapse; empty-cells: hide; border-spacing: 1pt; box-shadow: 2px 2px 3px #888888;}\n";
echo "\t\ttr { vertical-align: center; height: 23px;}\n";
echo "\t\tth { color: #0000a0; font-family: extFont; font-size: 18px; font-weight: bold; white-space: nowrap; padding: 0 5px; height: 21px; text-align: center; border: 0px; background-color: #BFBFDC; }\n";
echo "\t\ttd { color: #0000a0; font-size: 18px; font-family: extFont; height: 21px; padding: 0 5px; }\n";
echo "\t\tinput { background: #f0f0f0; color: #0000a0; font-family: extFont; font-size: 18px; font-weight: normal; padding: 2px; border: 1px solid #d0d0d0; vertical-align: middle; height: 21px; }\n";
echo "\t\tinput:hover, input:focus { background-color: #f0f0f0; background-position: 0 -41px; border: 1px solid #0d0dd0; }\n";
echo "\t\tselect { color: #0000A0; background-color: #f0f0f0; font-family: extFont; font-size: 18px; font-weight: normal; border: 1px solid #a0a0a0; padding: 2px; vertical-align: middle; height: 23px; }\n";
echo "\tselect:hover, select:focus { background-color: #f0f0f0; border: 1px solid #0d0dd0; }\n";
echo "\t\toption { padding-left: 0.2cm; vertical-align: middle; }\n";
echo "\t\toption.disabled-option { color: graytext; font-weight: italic; }\n";
echo "\t\t.btnlite { font-weight: bold; cursor: pointer; padding: 1px 5px; font-size: ; border-color: #e0e0e0; border-radius: 5px; border: 1px solid #a0a0a0; height: 21px; width: 110px; box-shadow: 2px 2px 3px #888888; text-align: center; }\n";
echo "\t\tA:link { font-weight: bold; color: #0000a0; text-decoration: none;}\n";
echo "\t\tA:visited { font-weight: bold; color: #0000a0; text-decoration: none; }\n";
echo "\t\tA:active { font-weight: bold; color: #0000a0; text-decoration: none; }\n";
echo "\t\tA:hover { font-weight: bold; color: #d00000; text-decoration: none; }\n";
echo "\t\tA.clink:link { font-weight: bold; color: #0000a0; text-decoration: none; }\n";
echo "\t</style>\n";
echo "</head>\n";
echo "<body><br>\n\t<center>\n";
echo "<table style=\"width: 80%; border-top-left-radius:2em; border-top-right-radius:2em; background-color: #7878DC;\" cellpadding=\"0\" cellspacing=\"1\">\n";
echo "<tr><td colspan=\"2\" align=\"center\"><b><span style=\"font-family: extFont; font-weight: bold; color: #FFFFFF; font-size: 36px; text-shadow: 1px 1px #BFBFBF;\">".t2u($app)."</span></b>";
if ($company != "") echo "<br><span style=\"font-family: extFont; font-weight: bold; color: #FFFFFF; font-size: 24px;\">".t2u($company)."</span>\n";
if ($cmd == "show") {
$mx = 51 + $hfg;
if (count($arr) > 51) echo "<br><span style=\"font-family: extFont; font-weight: bold; color: #FFFFFF; font-size: 18px;\"><b>".t2u("หน่วย</b> $arr[$mx]")."</span>\n";
$mx = (int) ($mmt - 1);
echo "<form name=\"$idform\" id=\"$idform\" method=\"post\" action=\"index.php\" autocomplete=\"off\">\n";
echo "\t<input type=\"hidden\" name=\"usr\" value=\"$usr\">\n";
echo "\t<input type=\"hidden\" name=\"psw\" value=\"$psw\">\n";
echo "\t<input type=\"hidden\" name=\"cmd\" value=\"login\">\n";
echo "\t<span style=\"font-family: extFont; font-weight: bold; color: #FFFFFF; font-size: 18px;\">".t2u("เดือน")." <select style=\"cursor: pointer;\" name=\"mmt\">\n";
for ($i=0; $i<12; $i++) {
echo "\t\t<option value=\"";
$ii = $i + 1;
if ($ii<10) echo "0";
echo "$ii\"";
if ($mx == $i) echo " selected";
echo ">".t2u($ThaiMonth[$i])."</option>\n";
}
echo "</select> ".t2u("พ.ศ.")." <input type=\"text\" name=\"yyr\" size=\"5\" value=\"$yyr\">";
echo " <input type=\"submit\" class=\"btnlite\" value=\"".t2u("เรียกดูใหม่")."\"></span></form>\n";
} else echo "<br>";
echo "</td></tr>\n";
if ($cmd == "none") {
echo t2u("<tr style=\" box-shadow: 0px 2px 3px #888888;\"><th width=\"50%\">รายการ</th><th>รายละเอียด</th></tr>\n");
if ($msg != "") {
echo t2u("<tr><td colspan=\"2\" align=\"center\" style=\"background-color: #E0E0F0;\"><b>$msg</b></td></tr>\n");
}
echo "<form name=\"$idform\" id=\"$idform\" method=\"post\" action=\"index.php\" autocomplete=\"off\">\n";
echo "<input type=\"hidden\" name=\"cmd\" value=\"login\">\n";
echo "<tr><td colspan=\"2\" style=\"background-color: #FFFFFF;\"> </td></tr>\n";
echo t2u("<tr><td align=\"right\" style=\"background-color: #FFFFFF;\">Username</td>\n");
echo "\t<td style=\"background-color: #FFFFFF;\"> <input type=\"text\" size=\"20\" name=\"usr\" autofocus></td></tr>\n";
echo t2u("<tr><td align=\"right\" style=\"background-color: #FFFFFF;\">รหัสผ่าน</td>\n");
echo "\t<td style=\"background-color: #FFFFFF;\"> <input type=\"text\" size=\"20\" name=\"psw\"></td></tr>\n";
echo t2u("<tr><td align=\"right\" style=\"background-color: #FFFFFF;\">เลือกเดือน</td>\n");
echo "\t<td style=\"background-color: #FFFFFF;\"> <select style=\"cursor: pointer;\" name=\"mmt\">";
$today = date("Y-m-d");
$mon = (int) substr($today, 5, 2);
$yer = (int) substr($today, 0, 4);
for ($i=1; $i<13; $i++) {
echo "\t\t<option value=\"";
if ($i < 10) { echo "0"; }
echo "$i\"";
if ($mon == $i) { echo " selected"; }
echo ">".t2u($ThaiMonth[$i - 1])."</option>\n";
}
echo "</select></td></tr>\n";
$yer = $yer + 543;
echo t2u("<tr><td align=\"right\" style=\"background-color: #FFFFFF;\">ใส่ปี พ.ศ.</td>\n");
echo "\t<td style=\"background-color: #FFFFFF;\"> <input type=\"text\" name=\"yyr\" value=\"$yer\" size=\"5\"></td></tr>\n";
echo "<tr><td colspan=\"2\" align=\"center\" style=\"background-color: #FFFFFF;\"><br><input type=\"submit\" value=\"".t2u(" ส่งข้อมูล ")."\" class=\"btnlite\"><br><br></td></tr>\n";
echo "</form>\n";
}
if ($cmd == "admin") {
echo t2u("<tr style=\" box-shadow: 0px 2px 3px #888888;\"><th width=\"50%\">รายการ</th><th >รายละเอียด</th></tr>\n");
if ($msg != "") {
echo t2u("<tr><td class=\"txstyle\" colspan=\"2\" style=\"background-color: #E0E0F0;\">$msg</td></tr>\n");
}
echo "<script type='text/javascript'>\n";
echo "\tfunction cagFile() {\n";
echo "\t\tvar vpt = document.getElementById(\"fil\").value;\n";
echo "\t\tdocument.getElementById(\"fban\").innerHTML = vpt;\n";
echo "\t};\n";
echo "\tfunction getFile() {\n";
echo "\t\tdocument.getElementById(\"fil\").click();\n";
echo "\t};\n";
echo "\tfunction cag2File() {\n";
echo "\t\tvar vpt = document.getElementById(\"til\").value;\n";
echo "\t\tdocument.getElementById(\"fban2\").innerHTML = vpt;\n";
echo "\t};\n";
echo "\tfunction get2File() {\n";
echo "\t\tdocument.getElementById(\"til\").click();\n";
echo "\t};\n";
echo "</script>\n";
echo "<form name=\"$idform\" id=\"$idform\" method=\"post\" action=\"index.php\" enctype=\"multipart/form-data\" autocomplete=\"off\">\n";
echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"1000000000\">\n";
echo "<input type=\"hidden\" name=\"cmd\" value=\"upload\">\n";
echo "<tr><td colspan=\"2\" style=\"background-color: #FFFFFF;\"> </td></tr>\n";
echo t2u("<tr><td class=\"txstyle\" valign=\"top\" align=\"right\" style=\"background-color: #FFFFFF;\">เลือกไฟล์ข้อมูลสลิ๊ปเงินเดือนหรือข้อมูลรับรองภาษี : </td>\n");
echo "\t<td class=\"txstyle\" align=\"left\" style=\"background-color: #FFFFFF;\"><div style=\"width: 250px;\" id=\"fban\"><b>".t2u("<ยังไม่ได้เลือกไฟล์>")."</b></div>\n<div class=\"btnlite\" onclick=\"getFile();\">".t2u("คลิ๊กที่นี่เพื่อเลือกไฟล์")."</div>\n<div style=\"height: 0px; width: 0px; overflow: hidden;\"><input type=\"file\" name=\"fil\" id=\"fil\" style=\"display: none;\" onchange=\"cagFile();\"></div></td></tr>\n";
echo "<tr><td colspan=\"2\" style=\"background-color: #FFFFFF;\"> </td></tr>\n";
echo "<tr><td colspan=\"2\" align=\"center\" style=\"background-color: #FFFFFF;\"><input type=\"submit\" value=\" ".t2u("ส่งข้อมูล")." \" class=\"btnlite\"> ";
echo "<input type=\"button\" value=\" ".t2u("ยกเลิก")." \" onclick=\"location.href='index.php'\" class=\"btnlite\"><br><br></td></tr>\n";
echo "</form>\n";
echo "<form name=\"x$idform\" id=\"x$idform\" method=\"post\" action=\"index.php\" enctype=\"multipart/form-data\" autocomplete=\"off\">\n";
echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"1000000000\">\n";
echo "<input type=\"hidden\" name=\"cmd\" value=\"signal\">\n";
echo "<tr><th colspan=\"2\" align=\"center\"><b>".t2u("การอัพไฟล์ลายเซ็นต์ในหนังสือรับรองภาษี โปรดอัพไฟล์ด้านล่างนี้")."</b></th></tr>\n";
echo "<tr><td class=\"txstyle\" align=\"right\" style=\"background-color: #FFFFFF;\">".t2u("ใส่ปีภาษีสำหรับลายเซ็นต์ : ")."</td>\n";
$today = getdate();
$yy = $today["year"] + 542;
echo "\t<td class=\"txstyle\" align=\"left\" style=\"background-color: #FFFFFF;\"><input type=\"text\" name=\"yax\" size=\"7\" value=\"$yy\"></td></tr>\n";
echo "<tr><td class=\"txstyle\" valign=\"top\" align=\"right\" style=\"background-color: #FFFFFF;\">".t2u("เลือกไฟล์รูปภาพลายเซ็นต์ : ")."</td>\n";
echo "\t<td class=\"txstyle\" align=\"left\" style=\"background-color: #FFFFFF;\"><div style=\"width: 250px;\" id=\"fban2\"><b>".t2u("<ยังไม่ได้เลือกไฟล์>")."</b></div>\n<div class=\"btnlite\" onclick=\"get2File();\">".t2u("คลิ๊กที่นี่เพื่อเลือกไฟล์")."</div>\n<div style=\"height: 0px; width: 0px; overflow: hidden;\"><input type=\"file\" size=\"50\" name=\"til\" id=\"til\" onchange=\"cag2File()\"></div></td></tr>\n";
echo "<tr><td align=\"center\" colspan=\"2\" style=\"background-color: #FFFFFF;\"><br><input type=\"submit\" value=\"".t2u("ส่งไฟล์ลายเซ็นต์")."\" class=\"btnlite\"><br><br></td></tr></form>\n";
echo "<tr><td colspan=\"2\" align=\"center\" style=\"background-color: #E0E0F0;\"><br>\n";
echo "<table style=\"width: 98%;\" cellpadding=\"0\" cellspacing=\"1\">\n";
echo t2u("<tr><th colspan=\"6\" style=\" box-shadow: 0px 2px 3px #888888;\">รายชื่อแฟ้มข้อมูลที่ได้บันทึกไว้แล้ว</th></tr>\n");
$i = 1;
$allfiles = array();
if ($dir = opendir($folder)) {
while (($afile = readdir($dir)) !== false) {
$allfiles[] = $afile;
}
closedir($dir);
}
sort($allfiles);
foreach($allfiles as $data) {
if (($data != "..") && ($data != ".")) {
if ($i == 1) { echo "<tr>"; }
echo "<td class=\"txstyle\" width=\"16.66%\" align=\"left\" style=\"background-color: #FFFFFF;\"> $data [";
echo t2u("<a onmouseover=\"status='ลบแฟ้มข้อมูล $data';return true;\" ");
echo "style=\"TEXT-DECORATION: none\" onmouseout=\"status='';return true;\" ";
echo "href=\"index.php?cmd=xdelx&fil=$data\">".t2u("ลบ")."</a>]";
echo "</td>\n";
$i++;
if ($i == 7) { echo "</tr>\n"; $i = 1; }
}
}
echo "</tr>\n";
echo "</table><br></td></tr>\n";
}
if ($cmd == "show") {
$bbk = $arr[2];
$bbk = substr($bbk, 0, strlen($bbk) - 4)."xxxx";
echo "<tr><td colspan=\"2\" bgcolor=\"#E0E0F0\" align=\"center\"><br>";
echo "<table style=\"width: 98%; border: 1px solid #BFBFDC;\" cellpadding=\"0\" cellspacing=\"1\">\n";
if ($types_bank == 1) {
echo t2u("<tr><th colspan=\"4\"> <b>ชื่อ - นามสกุล</b> : $arr[0]</th>\n");
echo t2u("\t<th colspan=\"2\" align=\"right\"><b>โอนเข้าบัญชี</b> : $bbk </th></tr>\n");
} else {
echo t2u("<tr><th colspan=\"6\"> <b>ชื่อ - นามสกุล</b> : $arr[0]</th></tr>\n");
}
if ($types_slip == 1) {
echo t2u("<tr style=\"box-shadow: 0px 2px 3px #888888;\"><th colspan=\"2\" align=\"center\"><b>รายการรับ</b></th>\n");
echo t2u("\t<th colspan=\"4\" align=\"center\"><b>รายการจ่าย</b></th></tr>\n");
$pp = (int) ($hhh[2] / 2);
$rr = (int) ($hhh[1]);
if ($rr > $pp) { $ed = $rr; } else { $ed = $pp; }
$rs = 3;
$rp1 = $rr + $rs + 1;
$rp2 = $rp1 + $pp;
$cx1 = 0;
$cx2 = 0;
//if (trim($hdd[count($hdd) - 1]) == "A") {
if ($hfg == 1) {
$cx = $rr + $rs - 2;
$cx1 = (float) str_replace(",", "", $arr[$rs]);
$cx2 = (float) str_replace(",", "", $arr[$cx]);
$arr[$rs] = Number_Format(($cx1 + $cx2), 2);
$cx1 = $cx2;
$arr[$cx] = $arr[$cx +1];
$hdd[$cx] = $hdd[$cx + 1];
$arr[$cx + 1] = "";
$hdd[$cx + 1] = "";
}
for ($i = 1; $i <= $ed; $i++) {
echo "<tr>";
if ($i <= $rr) {
echo "<td align=\"left\" width=\"16.66%\"> ".t2u($hdd[$rs])."</td>\n";
echo "\t<td align=\"right\" width=\"16.66%\">$arr[$rs] </td>\n";
} else {
echo "<td width=\"16.66%\" colspan=\"2\"> </td>\n";
}
echo "\t<td align=\"left\" width=\"16.66%\"> ".t2u($hdd[$rp1])."</td>\n";
echo "\t<td align=\"right\" width=\"16.66%\">$arr[$rp1] </td>\n";
echo "\t<td align=\"left\" width=\"16.66%\"> ".t2u($hdd[$rp2])."</td>\n";
echo "\t<td align=\"right\" width=\"16.66%\">$arr[$rp2] </td></tr>\n";
$rs++;
$rp1++;
$rp2++;
}
if (($pp * 2) < $hhh[2]) {
echo "<tr><td> </td><td> </td><td> </td><td> </td>";
echo "<td align=\"left\"> ".t2u($hdd[$rp2])."</td><td align=\"right\">$arr[$rp2] </td></tr>\n";
$rp2++;
}
$rs = $rr + 3;
echo "<tr><th align=\"center\"><b>".t2u($hdd[$rs])."</b></th><th style=\"text-align: right;\"><b>$arr[$rs] </b></td>\n";
echo "\t<th align=\"center\" colspan=\"3\" bgcolor=\"#f0f0f0\"><b>".t2u($hdd[$rp2])."</b></th><th style=\"text-align: right;\"><b>$arr[$rp2]</b> </th></tr>\n";
$rp2++;
$csp = 5;
echo "<tr>\n";
if (count($arr) > 53)
$xc = 53 + $hfg;
else
$xc = count($arr);
if ($xc >= (53 + $hfg)) {
echo " <th style=\"text-align: left;\" colspan=\"2\"><b>".t2u("วันที่จ่าย")."</b> : ".t2u($arr[$xc - 1])."</th>\n";
$csp = 3;
}
echo "<th style=\"text-align: right;\" colspan=\"$csp\"><b>".t2u("ยอดคงเหลือโอนเข้าบัญชี")."</b></th><th style=\"text-align: right;\"><b>$arr[$rp2]</b> </th></tr>\n";
if (($cx1 + $cx2) != 0) {
$cx2 = (float) str_replace(",", "", $arr[$rp2]);
echo "<tr><th style=\"text-align: right;\" colspan=\"3\">".t2u("เงินเดือนครึ่งแรก")."</th><th style=\"text-align: right;\">".number_format($cx1, 2)." </th><th style=\"text-align: right;\">".t2u("เงินเดือนครึ่งหลัง")."</th><th style=\"text-align: right;\">".number_format($cx2 - $cx1, 2)." </th></tr>\n";
}
if (count($arr) > 53) {
$xx = (int) ($arr[count($arr) - 1]);
$lx = strlen($arr[count($arr) - 1]);
if (($xx != 0) && ($lx < 4)) {
echo "<tr><td colspan=\"6\"><table width=\"100%\"><tr><td colspan=\"8\"><b>".t2u("งดหักเนื่องจากไม่เป็นไปตามหลักเกณฑ์ที่กำหนดไว้ในระเบียบกระทรวงศึกษาธิการ ว่าด้วยการหักเงินเดือนเงินบำเหน็จบำนาญข้าราชการฯ พ.ศ.2551 .-")."</b></td></tr>\n";
$n = 1;
$i = 53 + $hfg;
echo "<tr>";
while ($i < (count($arr) - 1)) {
if ($n == 9) {
$n = 1;
echo "</tr><tr>";
}
echo "<td width=\"15%\" align=\"left\"><li>".t2u($arr[$i])."</li></td>";
$i++;
echo "<td width=\"10%\" align=\"right\">$arr[$i]</td>";
$i++;
$n = $n + 2;
}
echo "</tr></table></td></tr>\n";
}
}
} else {
$rr = (int) $hhh[1];
$pp = (int) $hhh[2];
echo "<tr style=\"box-shadow: 0px 2px 3px #888888;\"><th colspan=\"6\"> <b>".t2u("รายการรับ")."</th></tr>\n";
$rs = 0;
for ($i = 0; $i < $rr; $i++) {
$rp1 = $i + 3;
$cc = (int) $arr[$rp1];
if ($cc != 0) {
if ($rs == 0) { echo "<tr>"; }
echo "<td align=\"left\" width=\"16.66%\"> ".t2u($hdd[$rp1])."</td>\n\t<td align=\"right\" width=\"16.66%\">$arr[$rp1] </td>\n";
$rs++;
if ($rs == 3) { echo "</tr>"; $rs = 0; }
}
}
if (($rs < 3) && ($rs != 0)) { $cc = (3 - $rs) * 2; echo "\t<td colspan=\"$cc\"> </td></tr>\n"; }
$rp1++;
echo "<tr><th colspan=\"5\" align=\"right\"><b>".t2u("รวมรายการรับ")."</b> </th>\n\t<th style=\"text-align: right;\"><b>$arr[$rp1]</b> </th></tr>\n";
echo "<tr style=\"box-shadow: 0px 2px 3px #888888;\"><th colspan=\"6\"> <b>".t2u("รายการหัก")."</th></tr>\n";
$rs = 0;
for ($i = 0; $i < $pp; $i++) {
$rp1++;
$cc = (int) $arr[$rp1];
if ($cc != 0) {
if ($rs == 0) { echo "<tr>"; }
echo "<td align=\"left\" width=\"16.66%\"> ".t2u($hdd[$rp1])."</td>\n\t<td align=\"right\" width=\"16.66%\">$arr[$rp1] </td>\n";
$rs++;
if ($rs == 3) { echo "</tr>"; $rs = 0; }
}
}
if (($rs < 3) && ($rs != 0)) { $cc = (3 - $rs) * 2; echo "\t<td colspan=\"$cc\"> </td></tr>\n"; }
$rp1++;
echo "<tr><th colspan=\"5\" align=\"right\"><b>".t2u("รวมรายการหัก")."</b> </td>\n\t<th style=\"text-align: right;\"><b>$arr[$rp1]</b> </th></tr>\n";
$rp1++;
echo "<tr><th colspan=\"5\" align=\"right\"><b>".t2u("รวมเงินโอนเข้าบัญชี")."</b> </th>\n\t<th style=\"text-align: right;\"><b>$arr[$rp1]</b> </th></tr>\n";
if (count($arr) > 53) {
$xx = (int) ($arr[count($arr) - 1]);
$lx = strlen($arr[count($arr) - 1]);
if (($xx != 0) && ($lx < 4)) {
echo "<tr><td colspan=\"6\"><table width=\"100%\"><tr><td colspan=\"8\"><b>".t2u("งดหักเนื่องจากไม่เป็นไปตามหลักเกณฑ์ที่กำหนดไว้ในระเบียบกระทรวงศึกษาธิการ ว่าด้วยการหักเงินเดือนเงินบำเหน็จบำนาญข้าราชการฯ พ.ศ.2551 .-")."</b></td></tr>\n";
$n = 1;
$i = 53 + $hfg;
echo "<tr>";
while ($i < (count($arr) - 1)) {
if ($n == 9) {
$n = 1;
echo "</tr><tr>";
}
echo "<td width=\"15%\" align=\"left\"><li>".t2u($arr[$i])."</li></td>";
$i++;
echo "<td width=\"10%\" align=\"right\">$arr[$i]</td>";
$i++;
$n = $n + 2;
}
echo "</tr></table></td></tr>\n";
}
}
}
echo "</table><br></td></tr>\n";
echo "<tr><td colspan=\"2\" align=\"center\" bgcolor=\"#E0E0F0\"><input type=\"button\" value=\"".t2u("กลับไปหน้าหลัก")."\" class=\"btnlite\" onclick=\"location.href='index.php'\"> ";
echo "<input type=\"button\" value=\" ".t2u("พิมพ์สลิ๊ป")." \" class=\"btnlite\" onclick=\"javascript:window.open('./repslp";
if ($types_slip == 2) echo "2";
echo ".php?app=".t2u($app)."&tag=$usr&fd=$folder&fi=$mmt$yyr&bk=$types_bank&cm=".t2u($company)."', '_blank')\">";
echo "<br><br></td></tr>\n";
echo "<tr><td colspan=\"2\" align=\"center\" bgcolor=\"#E0E0F0\">\n";
echo "<table style=\"width: 98%;\" cellpadding=\"0\" cellspacing=\"1\">\n";
echo "<tr style=\"box-shadow: 0px 2px 3px #888888;\"><th> <b>".t2u("รายการหนังสือรับรองภาษีหัก ณ ที่จ่าย")." .-</b></th></tr>\n";
echo "<tr><td width=\"100%\">\n";
$flg = 0;
$allfiles = array();
if ($dir = opendir($folder)) {
while (($afile = readdir($dir)) !== false) {
$allfiles[] = $afile;
}
closedir($dir);
}
sort($allfiles);
foreach($allfiles as $data) {
if (($data != "..") && ($data != ".")) {
if (substr($data, 0, 3) == "tax") {
$yy = substr($data, 3, 4);
$ff = substr($data, 3, strpos($data, ".") - 3);
echo "<li><a onmouseover=\"status='".t2u("พิมพ์หนังสือรับรองปี")." $yy'; return true;\" onmouseout=\"status=''; return true;\" style=\"TEXT-DECORATION: none\" href=\"reppdf.php?fd=$folder&fi=$ff&id=$usr&th=$Thai_Code\" target=\"_blank\">".t2u("พิมพ์รายงานหนังสือรับรองภาษีหัก ณ ที่จ่าย ปีภาษี $ff เป็นไฟล์แบบ Pdf")."</a></li>\n";
$flg = 1;
}
}
}
if ($flg == 0) echo "<br><div align=\"center\"><b>* * * ".t2u("ยังไม่มีรายการหนังสือรับรองภาษีหัก ณ ที่จ่าย")." * * *</b></div><br><br>\n";
echo "</td></tr></table><br></td></tr>\n";
}
//echo "<tr><td colspan=\"2\"> </td></tr>\n";
// Create by ...
echo "<tr><td colspan=\"2\" align=\"right\" style=\"background-color: #FFFFFF;\"><br><hr width=\"98%\" noshade style=\"height: 1px; color: #a0a0a0; box-shadow: 2px 2px 3px #888888;\">".t2u($address)." <br>";
echo "Create by : <a onmouseover=\"status='".t2u("เปิดข้อมูลจากเว็ปไซต์")." http://msglive.org';return true;\" ";
echo "style=\"TEXT-DECORATION: none\" onmouseout=\"status='';return true;\" ";
echo "href=\"http://msglive.org\" target=\"_blank\">http://msglive.org</a> Version 3.5.2 ©2565-2575. <br>All style support in IE9+, Firefox, Chrome, Safari, and Opera. <br><br></td></tr>\n";
echo "</table></center><br><br></body></html>\n";
?>