| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/room/New folder/ |
Upload File : |
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ใบแจ้งเงินเดือน</title>
<?php
//$x=10.00;
error_reporting(~E_NOTICE);
if (isset($_GET['code'])) {
$_SESSION['Login'] = iconv("tis-620","utf-8",$_GET['code']);
//echo $_SESSION['Login'].'<br>';
}
/*
$month_arr2=array(
"01"=>"มกราคม",
"02"=>"กุมภาพันธ์",
"03"=>"มีนาคม",
"04"=>"เมษายน",
"05"=>"พฤษภาคม",
"06"=>"มิถุนายน",
"07"=>"กรกฎาคม",
"08"=>"สิงหาคม",
"09"=>"กันยายน",
"10"=>"ตุลาคม",
"11"=>"พฤศจิกายน",
"12"=>"ธันวาคม"
);
*/
$Smonth_arr= Array("","มค." , "กพ." , "มีค." , "เมย." , "พค." , "มิย." , "กค." , "สค." , "กย." , "ตค." ,"พย." , "ธค" );
$month_arr= Array("","มกราคม" , "กุมภาพันธ์" , "มีนาคม" , "เมษายน" , "พฤษภาคม" , "มิถุนายน" , "กรกฏาคม" , "สิงหาคม" , "กันยายน" , "ตุลาคม" ,"พฤศจิกายน" , "ธันวาคม" );
if(!isset($_POST['month_check']) && !isset($_POST['year_check'])){
$date = date("d-m-Y");
$month_m = date("m"); //เดือน
$date_d = date("d"); //วันที่
$_SESSION["year"] = substr('0000'.trim(substr($date,6,4)),-4); //ปีพ.ศ.
$num_month_day=date("t"); // หาจำนวนวันของเดือน
$start_date = $_SESSION["year"]."-".$month_m."-01";
$end_date = $_SESSION["year"]."-".$month_m."-".$num_month_day;
} else { // ถ้ามีการส่งข้อมูล เดือนและปี มา ให้ใช้เดือนและปี ของค่าที่ส่งมาเป้นตำกำหนด
$month_m = $_POST['month_check'];
$_SESSION["year"] = $_POST['year_check'];
$month_y = substr('0000'.trim(substr($_SESSION["year"],0,4)) ,-4)."-".$_POST['month_check']; // จัดรูปแบบปีและเดืนอที่ส่งมาในรูปแบบ /00/0000
$num_month_day=date("t",strtotime($_POST['year_check']."-".$_POST['month_check']."-01")); // หาจำนวนวันของเดือน
$start_date = $month_y."-01";
$end_date = $month_y."-".$num_month_day;
}
?>
<script src="jquery-2.1.3.min.js"></script>
<link href="/Salary/bootstrap-3.3.7-dist/css/bootstrap.css" rel="stylesheet" />
<link href="/Salary/bootstrap-3.3.7-dist/css/bootstrap-theme.css" rel="stylesheet" />
<script src="/Salary/bootstrap-3.3.7-dist/js/bootstrap.js"></script>
<link href="/Salary/dist/css/bootstrap-datepicker.css" rel="stylesheet" />
<script src="/Salary/dist/js/bootstrap-datepicker-custom.js"></script>
<script src="/Salary/dist/locales/bootstrap-datepicker.th.min.js" charset="UTF-8"></script>
<script>
/*$(document).ready(function () {
$('.thdatepicker').datepicker({
format: 'dd/mm/yyyy',
todayBtn: true,
language: 'th', //เปลี่ยน label ต่างของ ปฏิทิน ให้เป็น ภาษาไทย (ต้องใช้ไฟล์ bootstrap-datepicker.th.min.js นี้ด้วย)
thaiyear: true //Set เป็นปี พ.ศ.
}).datepicker("setDate"); //กำหนดเป็นวันปัจุบัน
});*/
</script>
<script type="text/javascript">
function getValue(vname)
{
var n = document.getElementById(vname).value
return n;
}
function changeFunc() {
var URL;
URL= "<?php echo $_SERVER['PHP_SELF'] ?>";
URL+= "?&month_check=";
URL+= getValue('month_check');
URL+= "&year_check=";
URL+= getValue('year_check');
//URL+= "&code=".base64_encode($Login));
window.location= URL;
}
</script>
<style type="text/css">
@media print{
#hid{
display: none; /* ซ่อน */
}
#submit{
display: none; /* ซ่อน */
}
#form1{
display: none; /* ซ่อน */
}
#TBD{
display: none; /* ซ่อน */
}
}
</style>
<style type="text/css">
<!--
.style2 {
font-size: 20px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<table align="center"border="1" width="1000">
<tr>
<td>
<table align="center"border="0" width="1000">
<tr>
<td width="13%" align="right">
<img src="img/hpt.png" width="86" height="82" /> </td>
<td width="87%"> <span class="style2">โรงพยาบาลสัตหีบ กม.10</span><br />
33/37 หมู่ 1 ตำบลพลูตาหลวง อำเภอสัตหีบ จังหวัดชลบุรี 20180<br />
โทร. 038-245051, 0660056(250-254 หรือ 081-085) ต่อ 401 , 402
</td>
</tr>
</table>
</td>
</tr>
</table><br/>
<p align="center"><span class="style2"><strong>ใบแจ้งเงินเดือน</strong>/PAY SLIP</span></p>
<div style="margin:auto;width:500px;" align="center">
<form method="post" action="" id ="form1">
เลือกเดือน
<select name="month_check" id="month_check">
<?php for($i=1;$i<=12;$i++){ ?>
<option value="<?=sprintf("%02d",$i)?>" <?=((isset($_POST['month_check']) && $_POST['month_check']==sprintf("%02d",$i))
|| (!isset($_POST['month_check']) && date("m")==sprintf("%02d",$i)))?" selected":""?> >
<?=$month_arr[$i]?>
</option>
<?php } ?>
</select>
ปี
<select name="year_check" id="year_check">
<?php
$data_year=intval(date("Y",strtotime("-5 year")));
?>
<?php for($i=0;$i<=5;$i++){ ?>
<option value="<?=$data_year+$i?>" <?=((isset($_POST['year_check']) && $_POST['year_check']==intval($data_year+$i))
|| (!isset($_POST['year_check']) && date("Y")==intval($data_year+$i)))?" selected":""?> >
<?=intval($data_year+$i)+543?>
</option>
<?php } ?>
</select>
<input type="submit" name="showData" id="showData" value="แสดงข้อมูล" />
</form>
</div>
<?php
$name = $_SESSION['Login'];
$U = strpos($name,";");
$pname = substr($name,0,$U);
$name =substr($name,$U+1);
$U = strpos($name," ");
$lname = substr($name,$U+1);
$name = substr($name,0,$U);
$cUID='';
$serverName = "localhost"; //serverName\instanceName
$connectionInfo = array( "Database"=>"PhanthongHRM", "UID"=>"root", "PWD"=>"123456", "CharacterSet" => "UTF-8");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ){
$query = "Select EmpID ,BankNo1,Name3 From FactEmp Where EmpName = '".$name."' AND EmpSurname = '".$lname."'";
$result = sqlsrv_query($conn, $query);
if($result === false ) {
if( ($errors = sqlsrv_errors() ) != null) {
foreach( $errors as $error ) {
echo "SQLSTATE: ".$error[ 'SQLSTATE']."<br />";
echo "code: ".$error[ 'code']."<br />";
echo "message: ".$error[ 'message']."<br />";
}
}
}else{
while($row=sqlsrv_fetch_array($result,SQLSRV_FETCH_ASSOC)){
$cUID = $row['EmpID'];
$BankNo = $row['BankNo1'];
$Name = $row['Name3'];
break;
}
sqlsrv_free_stmt($result);
}
}
//echo $cUID.'<br>';
?>
<?php
$nSumAmt = 0; //รวมรายการับ
$nSumPay = 0; //รวมรายการหัก
$serverName = "localhost";
$connectionInfo2 = array( "Database"=>"PhanthongCFO", "UID"=>"root", "PWD"=>"123456" );
$MsConn2 = sqlsrv_connect( $serverName, $connectionInfo2);
$sql2 = "select * from vwTotalPay1 where EmpID ='$cUID' AND PayDate0>='".$start_date."' AND PayDate0 <='".$end_date."'order by PayDate0";
$stmt2 = sqlsrv_query( $MsConn2, $sql2);
if(!$stmt2){
echo "ไม่สามารถเชื่อมต่อฐานข้อมูลได้";
}
$Head = true ;
while( $row2 = sqlsrv_fetch_array($stmt2, SQLSRV_FETCH_ASSOC)) {
if ($Head){
//$Head = false;
$EmpID = iconv("tis-620","utf-8",$row2["EmpID"]);
$Emp = iconv("tis-620","utf-8",$row2["EmpType"]);
$Dep = iconv("tis-620","utf-8",$row2["Department1"]);
?>
<table align="center" border="1" width="1000">
<tr>
<td>
<table align="center"border="0" width="100%">
<tr>
<td width="16%" height="29" align="right"> <strong>รหัสพนักงาน</strong> : </td>
<td width="36%"> <?php echo $cUID;?></td>
<td width="12%"align="right"> <strong>ตำแหน่ง </strong> : </td>
<td width="39%"> <?php echo $Emp; ?></td>
</tr>
<tr>
<td width="16%" align="right"> <strong>ชื่อ - นามสกุล</strong>: </td>
<td width="36%"> <?php echo $Name;?></td>
<td width="12%" align="right"> <strong>สังกัด</strong> : </td>
<td width="39%"> <?php echo $Dep;?></td>
</tr>
<tr>
<td width="16%" align="right"> <strong>เลขที่บัญชี </strong> : </td>
<td width="36%"> <?php echo $BankNo;?></td>
<td width="12%" align="right"> <strong>ประจำเดือน</strong>: </td>
<td width="39%">
<?php
if(!isset($_POST['month_check'])&& !isset($_POST['year_check'])){
echo $month_arr[date("n")]." ".substr('0000'.trim(substr($_SESSION["year"],0,4)
+543) ,-4);
}else{
$month_m = $_POST['month_check'];
$_SESSION["year"] = $_POST['year_check'];
echo $month_arr[(int)$month_m]." ".substr('0000'.trim(substr($_SESSION["year"],0,4)
+543) ,-4);
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table><br />
<?php
if ($Head){
$Head = false;
echo "<table border='1' align='center' width='990'>";
//หัวข้อตาราง
echo "<tr align='center' bgcolor='#CCCCCC'><td >วัน/เดือน/ปี</td><td >งวด</td>
<td>หมวดเงิน</td><td>หมวดเงินย่อย</td><td>ประเภท</td><td>จำนวน</td>";
}
}
$PayMT = iconv("tis-620","utf-8",$row2["PaymentType"]);
$PayM2 = iconv("tis-620","utf-8",$row2["Payment2"]);
$PayM1 = iconv("tis-620","utf-8",$row2["Payment1"]);
$PayT = iconv("tis-620","utf-8",$row2["PayType"]);
$Amt = $row2["PayAmt"];
if ($Amt >= 0)$nSumAmt+= $Amt;
else $nSumPay += $Amt;
$x = number_format($nSumPay+$nSumAmt, 2, '.', ',');
$date = $row2["PayDate0"]->format("d/m/Y");
$date = substr($date,0,2).' '.$Smonth_arr[(int)substr($date,3,2)]. substr('0000'.trim(substr($date,6,4)+543) ,-4);
$Amtt = number_format($Amt, 2, '.', ',');
echo "<tr>";
echo "<td width='10%'> ".$date."</td> ";
echo "<td align='left'> ".$PayMT."</td> ";
echo "<td> ".$PayM2."</td> ";
echo "<td> ".$PayM1."</td> ";
echo "<td width='10%'> ".$PayT."</td> ";
echo "<td align='right'>".$Amtt." </td> ";
echo "</tr>";
}
echo "<tr>";
echo "<td colspan='2' align='right' bgcolor='#CCCCCC'>".'รวม'." </td> ";
echo "<td colspan='3' bgcolor='#CCCCCC' align='center'> "."(".convert($x).")";
echo "<td bgcolor='#CCCCCC' align='right'>".$x." </td> ";
echo "</tr>";
echo "</table>";
?>
<?php
//}
?>
<?PHP
function convert($number){
$txtnum1 = array('ศูนย์','หนึ่ง','สอง','สาม','สี่','ห้า','หก','เจ็ด','แปด','เก้า','สิบ');
$txtnum2 = array('','สิบ','ร้อย','พัน','หมื่น','แสน','ล้าน','สิบ','ร้อย','พัน','หมื่น','แสน','ล้าน');
$number = str_replace(",","",$number);
$number = str_replace(" ","",$number);
$number = str_replace("บาท","",$number);
$number = explode(".",$number);
if(sizeof($number)>2){
return 'ทศนิยมหลายตัวนะจ๊ะ';
exit;
}
$strlen = strlen($number[0]);
$convert = '';
for($i=0;$i<$strlen;$i++){
$n = substr($number[0], $i,1);
if($n!=0){
if($i==($strlen-1) AND $n==1){ $convert .= 'เอ็ด'; }
elseif($i==($strlen-2) AND $n==2){ $convert .= 'ยี่'; }
elseif($i==($strlen-2) AND $n==1){ $convert .= ''; }
else{ $convert .= $txtnum1[$n]; }
$convert .= $txtnum2[$strlen-$i-1];
}
}
$convert .= 'บาท';
if($number[1]=='0' OR $number[1]=='00' OR
$number[1]==''){
$convert .= 'ถ้วน';
}else{
$strlen = strlen($number[1]);
for($i=0;$i<$strlen;$i++){
$n = substr($number[1], $i,1);
if($n!=0){
if($i==($strlen-1) AND $n==1){$convert
.= 'เอ็ด';}
elseif($i==($strlen-2) AND
$n==2){$convert .= 'ยี่';}
elseif($i==($strlen-2) AND
$n==1){$convert .= '';}
else{ $convert .= $txtnum1[$n];}
$convert .= $txtnum2[$strlen-$i-1];
}
}
$convert .= 'สตางค์';
}
return $convert;
}
/*
function DateThai($strDate)
{
$strYear = date("Y",strtotime($strDate))+543;
$strMonth= date("n",strtotime($strDate));
$strDay= date("j",strtotime($strDate));
$strHour= date("H",strtotime($strDate));
$strMinute= date("i",strtotime($strDate));
$strSeconds= date("s",strtotime($strDate));
$strMonthCut = Array("","มกราคม" , "กุมภาพันธ์" , "มีนาคม" , "เมษายน" , "พฤษภาคม" , "มิถุนายน" , "กรกฏาคม" , "สิงหาคม" , "กันยายน" , "ตุลาคม" ,"พฤศจิกายน" , "ธันวาคม" );
$strMonthThai=$strMonthCut[$strMonth];
return "$strMonthThai";
}
//$strDate = "2008-08-14 13:42:44";
//echo "ThaiCreate.Com Time now : ".DateThai($strDate);
*/
?><br /><br />
<table width="100%" border="0" align="center" >
<tr>
<td align="center" >
<?php
if ($Head){
$Head = false;
}else{
echo '<img src="img/ผอ001.PNG" /><br>
ลงชื่อ..................................... <br />
(นายชีวิน ประพันธ์)<br />
นายแพทย์ชำนาญการพิเศษ<br />
รักษาการในตำแหน่ง<br />
ผู้อำนวยการโรงพยาบาลสัตหีบ กม.10';
?>
</td>
<td align="center" >
<button id="hid" onclick="window.print();" class="btn btn-primary" > พิมพ์ </button>
</td>
<td align="center" >
<?php
echo '<br><img src="img/พี่001.PNG"/><br>
ลงชื่อ..................................... ผู้จ่ายเงิน
<br/>(นางจุรีรัตน์ คงวิจิตร)
<br/>เจ้าพนักงานการเงินและบัญชีชำนาญงาน';
}
?>
</td>
</tr>
</table>