<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" /> 
<title>无标题文档 </title> 
</head> 
<!--#include file="../Inc/Conn.asp" -->
<!--#include file="../Inc/SK.Session.asp" -->
<!--#include file="../Inc/SK.Funtion.asp" -->
<%if Not (Getconfig("SK_Finance")="0" AND (Session("Manager")="1" OR (JudgePopedomTF(Session("UserName"),"SK700000000") AND JudgePopedomTF(Session("UserName"),"SK700000704")))) then Call ReturnError()%>
<%
if Not isnumeric(JCID(F("ID"))) then Call ReturnError10()
set rs=server.createobject("adodb.recordset")
sql="SELECT * from SK_Wages where WagesID="&JCID(F("ID"))&""
rs.Open sql,conn,1,1
if rs.eof and rs.bof then Call ReturnError4()

Response.Buffer = True 
Response.ContentType = "application/vnd.ms-excel" 
SaveFilename=replace(replace(replace(now,":","")," ",""),"/","")
Thead="GZ_"
Response.AddHeader "content-disposition", "inline; filename = "&Thead&SaveFilename&".xls"

Response.Write("<table width=""99%"" align=""center"" border=""0"" cellspacing=""1"" cellpadding=""1"">")
Response.Write("<tr><td colspan=""2"" style=""font-size:18px;font-weight:bold; text-align:center;"">"&Rs("SK_Title")&"</td></tr>")
Response.Write("<tr><td colspan=""2"">")

set rsYg=Server.createobject("adodb.recordset")
sqlYg="select * from SK_WagesDetail where SK_WagesID="&Rs("WagesID")&" order by WagesDetailID asc"
rsYg.open sqlYg,conn,1,1
if rsYg.bof and rsYg.eof then 
Response.write"对不起，还没有工资信息。"
else
Response.Write("<table width=""100%"" cellpadding=""1"" cellspacing=""0"" style=""BORDER-top: #000000 1px solid; BORDER-left: #000000 1px solid;background-image:#000000;"">")
Response.Write("<tr>")
Response.Write("<th width=""6%"" style=""BORDER-RIGHT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF; height: 25px;line-height: 25px;font-size: 12px;"">员工姓名</th>")
set rsxx=Server.createobject("adodb.recordset")
sqlxx="select * from SK_WagesOption where SK_Di=0 order by WOptionID asc"
rsxx.open sqlxx,conn,1,1
A=0
while not rsxx.eof
A=A+1
Response.write"<th width=""6%"" style=""BORDER-RIGHT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF; height: 25px;line-height: 25px;font-size: 12px;"">"&rsxx("SK_WName")&"</th>"
rsxx.movenext
wend
rsxx.close
Set rsxx=Nothing

set rscc=Server.createobject("adodb.recordset")
sqlcc="select * from SK_WagesOption where SK_Di=1 order by WOptionID asc"
rscc.open sqlcc,conn,1,1
C=0
while not rscc.eof
C=C+1
Response.write"<th width=""6%"" style=""BORDER-RIGHT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF; height: 25px;line-height: 25px;font-size: 12px;"">"&rscc("SK_WName")&"</th>"
rscc.movenext
wend
rscc.close
Set rscc=Nothing
Response.write"<th width=""6%"" style=""BORDER-RIGHT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF; height: 25px;line-height: 25px;font-size: 12px;"">应发金额</th>"
Response.write"<th width=""6%"" style=""BORDER-RIGHT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF; height: 25px;line-height: 25px;font-size: 12px;"">应扣金额</th>"
Response.write"<th width=""6%"" style=""BORDER-RIGHT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF; height: 25px;line-height: 25px;font-size: 12px;"">实发金额</th>"
Response.Write("</tr>")

J=0
while not rsYg.eof
J=J+1
Response.Write("<tr>")
set rsau=Server.createobject("adodb.recordset")
sqlau="select * from SK_SystemUsers where UsersID="&rsYg("SK_UsersID")&""
rsau.open sqlau,conn,1,1
Response.Write("<td style=""BORDER-RIGHT: #000000 1px solid;BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF;text-align: center;height: 25px;line-height: 25px;font-size: 12px;"">"&rsau("SK_Oname")&"</td>")
rsau.close
Set rsau=Nothing

set rsyy=Server.createobject("adodb.recordset")
sqlyy="select * from SK_WagesOption where SK_Di=0 order by WOptionID asc"
rsyy.open sqlyy,conn,1,1
B=0
while not rsyy.eof
B=B+1
Response.write"<td style=""BORDER-RIGHT: #000000 1px solid;BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF;text-align: center;height: 25px;line-height: 25px;font-size: 12px;"">"&rsYg("SK_AA"&B)&"</td>"
rsyy.movenext
wend
rsyy.close
Set rsyy=Nothing

set rsdd=Server.createobject("adodb.recordset")
sqldd="select * from SK_WagesOption where SK_Di=1 order by WOptionID asc"
rsdd.open sqldd,conn,1,1
D=0
while not rsdd.eof
D=D+1
Response.write"<td style=""BORDER-RIGHT: #000000 1px solid;BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF;text-align: center;height: 25px;line-height: 25px;font-size: 12px;""><font color=red>"&rsYg("SK_BB"&D)&"</font></td>"
rsdd.movenext
wend
rsdd.close
Set rsdd=Nothing

set RsAG=server.createobject("adodb.recordset")
SqlAG="select sum(SK_AA1+SK_AA2+SK_AA3+SK_AA4+SK_AA5+SK_AA6+SK_AA7+SK_AA8+SK_AA9+SK_AA10) as AG from SK_WagesDetail where WagesDetailID="&rsYg("WagesDetailID")&""
RsAG.open SqlAG,Conn,1,1
Jvgz=formatnumber(RsAG("AG"),2)
RsAG.close
set RsAG=Nothing

set RsBG=server.createobject("adodb.recordset")
SqlBG="select sum(SK_BB1+SK_BB2+SK_BB3+SK_BB4+SK_BB5+SK_BB6+SK_BB7+SK_BB8+SK_BB9+SK_BB10) as BG from SK_WagesDetail where WagesDetailID="&rsYg("WagesDetailID")&""
RsBG.open SqlBG,Conn,1,1
Kvgz=formatnumber(RsBG("BG"),2)
RsBG.close
set RsBG=Nothing

Response.Write("<td style=""BORDER-RIGHT: #000000 1px solid;BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF;text-align: center;height: 25px;line-height: 25px;font-size: 12px;"">"&Jvgz&"</td>")
Response.Write("<td style=""BORDER-RIGHT: #000000 1px solid;BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF;text-align: center;height: 25px;line-height: 25px;font-size: 12px;"">"&Kvgz&"</td>")
Response.Write("<td style=""BORDER-RIGHT: #000000 1px solid;BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF;text-align: center;height: 25px;line-height: 25px;font-size: 12px;"">"&formatnumber((Jvgz-Kvgz),2)&"</td>")

Response.Write("</tr>")
rsYg.movenext
wend
Response.Write("</table>")
end if
rsYg.close
Set rsYg=Nothing

Response.Write("</td></tr>")
Response.Write("<tr><td olspan=""2"" style=""background:#FFFFFF;text-align: left;font-size: 12px;height: 25px;line-height: 25px;padding: 2px 2px 2px 2px;"">财务人员：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;审核签字：</td></tr>")
Response.Write("</table>")
Call CloseDB()
%>