<html xmlns="http://www.w3.org/1999/xhtml">
<!--#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"),"SK700000700")))) 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()
%>
<HEAD>
<TITLE>打印工资单</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="../images/Style.css" type=text/css rel=stylesheet>
<style type="text/css"> 
<!-- 
.headtitle{font-size: 18px;font-weight:bold; text-align: center; }

.headcompany {background:#FFFFFF;text-align:center;font-size: 13px;height: 20px;line-height: 20px;font-weight:bold;}

.headcontact {background:#FFFFFF;text-align:center;font-size: 12px;height: 18px;line-height: 18px;}

.td01 { BORDER-RIGHT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF; height: 25px;line-height: 25px;font-size: 12px;} 

.td02 {BORDER-RIGHT: #000000 1px solid;BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF;text-align: center;height: 25px;line-height: 25px;font-size: 12px;}

.td03 {BORDER-RIGHT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid;background-color: #FFFFFF;text-align: left;height: 50px;font-size: 12px;padding: 2px 2px 2px 2px;}

.td04 {background:#FFFFFF;text-align:right;font-size: 12px;height: 25px;line-height: 25px;padding: 2px 10px 2px 2px;}

.td05 {background:#FFFFFF;text-align: left;font-size: 12px;height: 25px;line-height: 25px;padding: 2px 2px 2px 2px;}

.ProList{BORDER-top: #000000 1px solid; BORDER-left: #000000 1px solid;background-image:#000000;} 
.prin{ 
font: 15pt "宋体"; color: #FFFFF; text-decoration: none; 
} 
.pageEnd {page-break-before:always} 
--> 
</style> 
<SCRIPT language=javascript>
function printpr()   //预览函数
{
document.all("PagesHead").click();//打印之前去掉页眉，页脚
document.all("dayinDiv").style.display="none"; //打印之前先隐藏不想打印输出的元素（此例中隐藏“打印”和“打印预览”两个按钮）
var OLECMDID = 7;
var PROMPT = 1; 
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser); 
WebBrowser1.ExecWB(OLECMDID, PROMPT);
WebBrowser1.outerHTML = "";
document.all("dayinDiv").style.display="";//打印之后将该元素显示出来（显示出“打印”和“打印预览”两个按钮，方便别人下次打印）
}
function printTure()   //打印函数
{
    document.all('PagesHead').click();//同上
    document.all("dayinDiv").style.display="none";//同上
    window.print();
    document.all("dayinDiv").style.display="";
}
function doPage()
{
    layLoading.style.display = "none";//同上
}
</SCRIPT>
<script language="VBScript">
dim hkey_root,hkey_path,hkey_key
hkey_root="HKEY_CURRENT_USER"
hkey_path="\Software\Microsoft\Internet Explorer\PageSetup"
function pagesetup_null()
on error resume next
Set RegWsh = CreateObject("WScript.Shell")
hkey_key="\header" 
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""
hkey_key="\footer"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""
end function
'//设置网页打印的页眉页脚为默认值
function pagesetup_default()
on error resume next
Set RegWsh = CreateObject("WScript.Shell")
hkey_key="\header" 
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&w&b页码，&p/&P"
hkey_key="\footer"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&u&b&d"
end function
</script>
</HEAD>
<BODY leftMargin=0 topMargin=0 rightMargin=0 bottomMargin=0 style="BACKGROUND-POSITION: center 50%">
<DIV align="center">

<table id="table" width="98%" align="center" border="0" cellspacing="1" cellpadding="1" > 
<tr> 
<td colspan="2" class="headtitle"><%=Rs("SK_Title")%></td> 
</tr>

<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
%>
<table width="100%" cellpadding="1" cellspacing="0" class="ProList"> 
<tr> 
<th width="6%" class="td01">员工姓名</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%"" class=""td01"">"&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%"" class=""td01"">"&rscc("SK_WName")&"</th>"
rscc.movenext
wend
rscc.close
Set rscc=Nothing
%>
<th width="6%" class="td01">应发金额</th>
<th width="6%" class="td01">应扣金额</th>
<th width="6%" class="td01">实发金额</th>
</tr>
<%
J=0
while not rsYg.eof
J=J+1
%>
<tr> 
<td class="td02"><%
set rsau=Server.createobject("adodb.recordset")
sqlau="select * from SK_SystemUsers where UsersID="&rsYg("SK_UsersID")&""
rsau.open sqlau,conn,1,1
Response.write""&rsau("SK_Oname")&""
rsau.close
Set rsau=Nothing
%></td> 
<%
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 class=""td02"">"&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 class=""td02""><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
%>
<td class="td02"><%=Jvgz%></td>
<td class="td02"><font color=red><%=Kvgz%></font></td>
<td class="td02"><%=formatnumber((Jvgz-Kvgz),2)%></td>
</tr>
<%
rsYg.movenext
wend
%>
</table> 
<%
end if
rsYg.close
Set rsYg=Nothing
%>

</td>
</tr>
<tr>
  <td class="td05">财务人员：</td>
  <td class="td05">审核签字：</td>
</tr> 
</table>
</DIV>
<DIV align="center" id="dayinDiv" name="dayinDiv">
<br>
<input type="button" class="button1" value=" 打印 " onclick="printTure();">
<input  type="button" class="button1" value=" 预览 " onclick="printpr();">
<input type="button" value=" 返回 " onClick="history.back(-1);" class="button1" />
<input type="button" value=" 关闭 " onClick="window.close();" class="button1" />
<input type="hidden" name="PagesHead" id="PagesHead" class="tab" value="清空页码" onclick="pagesetup_null()">&nbsp;&nbsp;
<input type="hidden" class="tab" value="恢复页码" onclick="pagesetup_default()">
</DIV>
</BODY>
<%Call CloseDB()%>
</HTML>