<!Doctype html />
<html>
<head>
<meta charset="tis-620"/>
<script src="jquery.js" ></script>
</head>
<body style="background-image:url('gradient2.png');background-repeat:repeat-x;font-size:100%;">
<!-- #include virtual="/v1/salary/dbconnect_grandattendance.asp"-->
<%
FUNCTION URLDecode(str)
Dim objScript,RepUrlDecode
Set objScript = Server.CreateObject("ScriptControl")
objScript.Language = "JavaScript"
RepUrlDecode = objScript.Eval("decodeURIComponent(""" & str & """)")
URLDecode = objScript.Eval("decodeURIComponent(""" & RepUrlDecode & """)")
Set RepUrlDecode = NOTHING
Set objScript = NOTHING
END FUNCTION
dim m_or_y1,xid1,monthyear1,namestopjob1,year1,topics,i,j,sp
myid=Request.QueryString("empid")
myname=URLDecode(Request.QueryString("empname"))
mysurname=URLDecode(Request.QueryString("empsurname"))
monthyear=Request.QueryString("empdate")
sp=split(monthyear,"/")
FUNCTION numday() 'วันที่ วันแรกของเดือน
Dim objScript,thismonth
Set objScript = Server.CreateObject("ScriptControl")
objScript.Language = "JavaScript"
thismonth=cint(sp(0))-1
numday= objScript.Eval("var x=new Date();x.getDay(x.setMonth(" & thismonth & ",0))")
Set objScript = NOTHING
END FUNCTION
FUNCTION numlastdayofmonth() 'วันที่ สุดท้ายของเดือน
Dim objScript,thismonth
Set objScript = Server.CreateObject("ScriptControl")
objScript.Language = "JavaScript"
thismonth=sp(0)
numlastdayofmonth= objScript.Eval("var d=new Date();d.getDate(d.setMonth(" & thismonth & ",0))")
' numlastdayofmonth= objScript.Eval(""" & str & """)
Set objScript = NOTHING
END FUNCTION
dim myweekday(6)
myweekday(0)= "อา."
myweekday(1)= "จ."
myweekday(2) = "อ."
myweekday(3) = "พ."
myweekday(4) = "พฤ."
myweekday(5) = "ศ."
myweekday(6) = "ส."
response.Expires=-1
response.CharSet="tis-620"
set rs=Server.CreateObject("ADODB.recordset")
sql="Select time_Date,time_IN,time_OUT,time_OT,time_OTTime,time_stopjob,time_remarkstopjob from tbltime WHERE empid='" & myid &"' and time_date like '%/" & monthyear &"' order by time_ID;"
rs.Open sql, conn
i=0
%>
<!--<div style="text-align:center;position:relative;border:1px solid black;width:580;" >-->
<!--<div class="timecard" style="border:1px solid black;width:580;" >-->
<div class="timecard" >
<br>
<div style="color:blue;font-size:larger;"><strong>รหัส: </strong> <%=myid%> <strong> ชื่อ: </strong><%=myname & " " & mysurname%> <strong>เดือน/ปี: </strong> <%=monthyear%></u></div><br>
<%
'dim testss,wk
'testss=numlastdayofmonth()
'response.Write(testss)
'response.Write(myweekday(0 ))
%>
<table style="width:580;" >
<tr>
<%for each x in rs.Fields
i=i+1
if x.name="time_Date" then
response.write("<th class='green' >ชื่อวัน</th><th class='green' id=th" & i & ">" & x.name & "</th>")
else
response.write("<th class='green' id=th" & i & ">" & x.name & "</th>")
end if
next%>
</tr>
<%
'คำนวณก่อน หา จำนวนวันของเดือนที่ต้องการ
j=numday()
j=j+1
for i = 1 to numlastdayofmonth()
response.write("<tr>")
if j=7 then j=0
if j=6 or j=0 then
response.write("<td style='background-color:lightgreen;' id=r" & i & "1>" & myweekday(j) & "</td>") 'ส อา ให้ลงสี
else
response.write("<td id=r" & i & "1>" & myweekday(j) & "</td>")
end if
if j=6 or j=0 then
response.write("<td style='background-color:lightgreen;' id=r" & i & "2>" & "-" & "</td>") 'ส อา ให้ลงสี
else
response.write("<td id=r" & i & "2>" & "-" & "</td>")
end if
if j=6 or j=0 then
response.write("<td style='background-color:lightgreen;' id=r" & i & "3>" & "-" & "</td>") 'ส อา ให้ลงสี
else
response.write("<td id=r" & i & "3>" & "-" & "</td>")
end if
if j=6 or j=0 then
response.write("<td style='background-color:lightgreen;' id=r" & i & "4>" & "-" & "</td>") 'ส อา ให้ลงสี
else
response.write("<td id=r" & i & "4>" & "-" & "</td>")
end if
if j=6 or j=0 then
response.write("<td style='background-color:lightgreen;' id=r" & i & "5>" & "-" & "</td>") 'ส อา ให้ลงสี
else
response.write("<td id=r" & i & "5>" & "-" & "</td>")
end if
if j=6 or j=0 then
response.write("<td style='background-color:lightgreen;' id=r" & i & "6>" & "-" & "</td>") 'ส อา ให้ลงสี
else
response.write("<td id=r" & i & "6>" & "-" & "</td>")
end if
if j=6 or j=0 then
response.write("<td style='background-color:lightgreen;' id=r" & i & "7>" & "-" & "</td>") 'ส อา ให้ลงสี
else
response.write("<td id=r" & i & "7>" & "-" & "</td>")
end if
if j=6 or j=0 then
response.write("<td class='remarkstopjob' style='background-color:lightgreen;' id=r" & i & "8>-</td>") 'ส อา ให้ลงสี
else
response.write("<td id=r" & i & "8>" & "-" & "</td>")
end if
response.write("</tr>")
j=j+1
next
%>
<script>
document.getElementById("th1").innerHTML="วันที่";
document.getElementById("th2").innerHTML="เวลาเข้า";
document.getElementById("th3").innerHTML="เวลาออก";
document.getElementById("th4").innerHTML="OT(ชม:นาที)";
document.getElementById("th5").innerHTML="OT(บาท/ชม.)";
document.getElementById("th6").innerHTML="เหตุหยุด";
document.getElementById("th7").innerHTML="หมายเหตุ";
</script>
<%
rs.MoveFirst
do until rs.EOF
'sql="Select time_Date,time_IN,time_OUT,time_OT,time_OTTime,time_stopjob,time_remarkstopjob from tbltime WHERE empid='" & myid &"' and time_date like '%/" & monthyear &"' order by time_ID;"
dim sp3,tin,tout
sp3=split(rs.Fields("time_Date"),"/")
j=trim(sp3(0))
tin=rs.Fields("time_IN")
tout=rs.Fields("time_OUT")
'Response.Write( j & " " & tin)
%>
<script>
//alert(" .."+'<%=tin%>'); // ถ้าไม่ใส่ quote ค่าจะไม่ส่งไป java กรณีเป้น สตริง
document.getElementById("r"+'<%=j%>'+"3").innerHTML='<%=rs.Fields("time_IN")%>';
document.getElementById("r"+'<%=j%>'+"4").innerHTML='<%=rs.Fields("time_OUT")%>';
document.getElementById("r"+'<%=j%>'+"5").innerHTML='<%=rs.Fields("time_OT")%>';
document.getElementById("r"+'<%=j%>'+"6").innerHTML='<%=rs.Fields("time_OTTime")%>';
document.getElementById("r"+'<%=j%>'+"7").innerHTML='<%=rs.Fields("time_stopjob")%>';
document.getElementById("r"+'<%=j%>'+"8").innerHTML='<%=rs.Fields("time_remarkstopjob")%>';
</script>
<%
rs.MoveNext
loop
rs.close
conn.close
set rs=nothing
set conn=nothing
%>
</table>
</div>
</body>
</html>
ไม่มีความคิดเห็น:
แสดงความคิดเห็น