<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" -->
<!--#include file="../Inc/SK.PageClass.asp" -->
<%if Not (Getconfig("SK_Finance")="0" AND (Session("Manager")="1" OR (JudgePopedomTF(Session("UserName"),"SK700000000") AND JudgePopedomTF(Session("UserName"),"SK700000705")))) then Call ReturnError()%>
<%
'Delete begin
if F("id")<>"" and RQ("Action")="Del" and (Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK700000706")) then
conn.execute("delete from SK_Wages where SK_Del=1 and WagesID in("&F("id")&")")
conn.execute("delete from SK_WagesDetail where SK_WagesID in("&F("id")&")")
'Event Begin
if getconfig("SK_Event")=0 then
set rsEvent=server.createobject("adodb.recordset")
sqlEvent="select * from SK_SystemEvent"
rsEvent.open sqlEvent,conn,1,3
rsEvent.AddNew
rsEvent("SK_Title")="彻底删除员工工资"
rsEvent("SK_User")=Session("UserName")
rsEvent("SK_Time")=Now()
rsEvent("SK_IP")=request.ServerVariables("Remote_Addr")
rsEvent.Update
rsEvent.Close 
set rsEvent=Nothing
end if
'Event End
Call Returnokback()
end if
'Delete End

'HF begin
if F("id")<>"" and RQ("Action")="HF" and (Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK700000707")) then
Bid=split(F("id"),",")
for i=0 to ubound(Bid)
set rs=server.createobject("adodb.recordset")
sql="select * from SK_Wages where SK_Del=1 and WagesID="&trim(Bid(i))
rs.open sql,Conn,1,3
rs("SK_Del")=0
rs("SK_DelUser")="0"
rs.Update
rs.close
Set rs=Nothing
next

'Event Begin
if getconfig("SK_Event")=0 then
set rsEvent=server.createobject("adodb.recordset")
sqlEvent="select * from SK_SystemEvent"
rsEvent.open sqlEvent,conn,1,3
rsEvent.AddNew
rsEvent("SK_Title")="恢复员工工资"
rsEvent("SK_User")=Session("UserName")
rsEvent("SK_Time")=Now()
rsEvent("SK_IP")=request.ServerVariables("Remote_Addr")
rsEvent.Update
rsEvent.Close 
set rsEvent=Nothing
end if
'Event End
Call Returnokback()
end if
'HF End
%>
<%
Set Page = new MyPages				'创建对象
Set Page.Conn = conn				'得到数据库连接对象
With Page
if Cint(F("PNum"))="" then
.PageSize=20		             '每页记录条数
else
.PageSize=Cint(F("PNum"))		'每页记录条数
end if
.PageParm = "P"					'页参数
'.PageIndex = 10				'当前页，可选参数，一般是生成静态时需要
.Database = "mssql"				'数据库类型,AC为access,MSSQL为sqlserver2000存储过程版,MYSQL为mysql,PGSQL为PostGreSql
.Table="SK_Wages INNER JOIN SK_SystemUsers ON SK_Wages.SK_SalesID=SK_SystemUsers.UsersID"				'表名
.Pkey="SK_Wages.WagesID"						'主键
.Field="SK_Wages.WagesID,SK_Wages.SK_Title,SK_Wages.SK_Feet,SK_Wages.SK_Atime,SK_Wages.SK_SalesID,SK_Wages.SK_Content"	'字段

'//搜索关键字开始
if F("AA")="1" AND F("Akey")<>"" then str1=" AND SK_Wages.SK_Title Like '%"&F("Akey")&"%'"
if F("AA")="2" AND F("Akey")<>"" then srt1=" AND Datediff(day,SK_Wages.SK_Atime,'"&F("Akey")&"')=0"
if F("AA")="3" AND F("Akey")<>"" then srt1=" AND SK_Wages.SK_Content Like '%"&F("Akey")&"%'"
'//搜索关键字结束

.Condition="SK_Wages.SK_Del=1"&str1&""

'//指定排序条件开始
.OrderBy="SK_Wages.WagesID Desc"

if F("BB")="0" AND F("PX")="1" then
.OrderBy="SK_Wages.SK_Title Asc"
elseif F("BB")="0" AND F("PX")="2" then
.OrderBy="SK_Wages.SK_Title Desc"
end if

'//指定排序条件结束

.RecordCount = 0	'总记录数，可以外部赋值，0不保存（适合搜索），-1存为session，-2存为cookies，-3存为applacation
.NumericJump = 3 '数字上下页个数，可选参数，默认为3，负数为跳转个数，0为显示所有
.Template = "总记录数：{$RecordCount} 总页数：{$PageCount} 每页记录数：{$PageSize} 当前页数：{$PageIndex} {$FirstPage} {$PreviousPage} {$NumericPage} {$NextPage} {$LastPage} {$InputPage} {$SelectPage}" '整体模板，可选参数，有默认值
.FirstPage = "首页" '可选参数，有默认值
.PreviousPage = "上一页" '可选参数，有默认值
.NextPage = "下一页" '可选参数，有默认值
.LastPage = "尾页" '可选参数，有默认值
.NumericPage = " {$PageNum} " '数字分页部分模板，可选参数，有默认值
End With
rs = Page.ResultSet() '记录集
rc = Page.RowCount() '可选，输出总记录数
nav = Page.Nav() '分页样式
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<title>员工工资回收</title>
<META http-equiv=Page-Enter content=SKCRM>
<META http-equiv=Page-Exit content=SKCRM>
<META content="MSHTML 6.00.3790.2858" name=GENERATOR>
<LINK href="../images/style.css" type=text/css rel=stylesheet>
<script type="text/javascript" src="../Inc/Check.js"></script>
<script type="text/javascript" src="../Inc/Calendar.js"></script>
<script type="text/javascript">
function sh(id)
{
 if (id==1)
 {
 {
 thisForm.target='_self';
 thisForm.action="?Action=HF";
 thisForm.submit();
 }
 }
 
  if (id==2)
 {
 {
 thisForm.target='_self';
 thisForm.action="?Action=Del";
 thisForm.submit();
 }
 }
}
</script>
<style type="text/css">
<!--
body {
margin: 5px 0px 5px 0px;
overflow-x:hidden;
overflow-y:auto;
}
-->
</style>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<TBODY>
  <tr>
    <td class="SK_Td_Top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="12" height="25"><img src="../images/tab_03.gif" width="12" height="25" /></td>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="46%" valign="middle">员工工资回收</td>
<td width="54%"></td>
</tr>
</table></td>
        <td width="16"><img src="../images/tab_07.gif" width="16" height="25" /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
<td>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<form method="Get">
<tr>
<td background="../images/tab_12.gif"></td>
<td>
<select name="AA" size="1">
<option value="1" <%if RQ("AA")=1 OR RQ("AA")="" then Response.Write("selected=""selected""")%>>工资主题</option>
<option value="2" <%if RQ("AA")=2 then Response.Write("selected=""selected""")%>>发放日期</option>
<option value="3" <%if RQ("AA")=3 then Response.Write("selected=""selected""")%>>工资备注</option>
</select> 
<input name="Akey" type="text" value="<%=F("Akey")%>" size="15">
 排序
<select name="BB" size="1">
<option value="0" <%if RQ("BB")=0 OR RQ("BB")="" then Response.Write("selected=""selected""")%>>工资主题</option>
</select>
<select name="PX" size="1">
<option value="1" <%if RQ("PX")=1 then Response.Write("selected=""selected""")%>> 升序</option>
<option value="2" <%if RQ("PX")=2 then Response.Write("selected=""selected""")%>> 降序</option>
</select>
 每页显示
<select name="PNum" size="1">
<option value="20" <%if RQ("PNum")=20 then Response.Write("selected=""selected""")%>>20</option>
<option value="25" <%if RQ("PNum")=25 then Response.Write("selected=""selected""")%>>25</option>
<option value="30" <%if RQ("PNum")=30 then Response.Write("selected=""selected""")%>>30</option>
<option value="40" <%if RQ("PNum")=40 then Response.Write("selected=""selected""")%>>40</option>
<option value="50" <%if RQ("PNum")=50 then Response.Write("selected=""selected""")%>>50</option>
<option value="60" <%if RQ("PNum")=60 then Response.Write("selected=""selected""")%>>60</option>
<option value="80" <%if RQ("PNum")=80 then Response.Write("selected=""selected""")%>>80</option>
<option value="100" <%if RQ("PNum")=100 then Response.Write("selected=""selected""")%>>100</option>
<option value="120" <%if RQ("PNum")=120 then Response.Write("selected=""selected""")%>>120</option>
<option value="150" <%if RQ("PNum")=150 then Response.Write("selected=""selected""")%>>150</option>
<option value="200" <%if RQ("PNum")=200 then Response.Write("selected=""selected""")%>>200</option>
<option value="300" <%if RQ("PNum")=300 then Response.Write("selected=""selected""")%>>300</option>
<option value="400" <%if RQ("PNum")=400 then Response.Write("selected=""selected""")%>>400</option>
<option value="500" <%if RQ("PNum")=500 then Response.Write("selected=""selected""")%>>500</option>
<option value="600" <%if RQ("PNum")=600 then Response.Write("selected=""selected""")%>>600</option>
<option value="800" <%if RQ("PNum")=800 then Response.Write("selected=""selected""")%>>800</option>
<option value="1000" <%if RQ("PNum")=1000 then Response.Write("selected=""selected""")%>>1000</option>
<option value="2000" <%if RQ("PNum")=2000 then Response.Write("selected=""selected""")%>>2000</option>
<option value="5000" <%if RQ("PNum")=5000 then Response.Write("selected=""selected""")%>>5000</option>
<option value="10000" <%if RQ("PNum")=10000 then Response.Write("selected=""selected""")%>>10000</option>
</select>
<input type="submit" name="go" value="查询" class="button1" /> 
</td>
<td background="../images/tab_15.gif"></td>
</tr>
</form>

<tr>
<td width="8" background="../images/tab_12.gif"></td>
<td>
<%
If IsNull(Rs) Then
response.write"对不起，没有你要的信息!"
else
%>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="b5d6e6">
<form name="thisForm" id="form1" method="post" action="">	  
<tr><td width="20" class="SK_Title">
<input name="chkall" type="checkbox" id="chkall" value="select" onClick="CheckAll(this.form)" style="border:0" /></td>
<td width="258" class="SK_Title">工资主题</td>
<td width="95" class="SK_Title">发放状态</td>
<td width="110" class="SK_Title">发放日期</td>
<td width="110" class="SK_Title">应发金额</td>
<td width="110" class="SK_Title">应扣金额</td>
<td width="110" class="SK_Title">实发金额</td>
<td width="100" class="SK_Title">财务人员</td>
<td width="40" class="SK_Title">修改</td>
</tr>
<%For i=0 To Ubound(Rs,2)%>
<tr onMouseOver="changeto()" onMouseOut="changeback()">
<td <%if i mod 2 = 0 then%>class="SK_Text"<%else%>class="SK_Texttwo"<%end if%>><input type="checkbox" name="ID" value="<%=Rs(0,i)%>" style="border:0"></td>
<td <%if i mod 2 = 0 then%>class="SK_Text1"<%else%>class="SK_Text1two"<%end if%>><a href="javascript:void(0)" onClick="javascript:var win=window.open('SK.ReWages.asp?id=<%=Rs(0,i)%>','Read','width=820,height=400,top=170,left=161,center:yes,status:no,help:no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes'); win.focus()"><%=Rs(1,i)%></a></td>
<td <%if i mod 2 = 0 then%>class="SK_Text"<%else%>class="SK_Texttwo"<%end if%>><%if Rs(2,i)=0 then Response.write"<font color=blue>未发放</font>" else Response.write"<font color=red>已发放</font>" end if%></td>
<td <%if i mod 2 = 0 then%>class="SK_Text"<%else%>class="SK_Texttwo"<%end if%>><%=Rs(3,i)%></td>
<td <%if i mod 2 = 0 then%>class="SK_Text"<%else%>class="SK_Texttwo"<%end if%>><%
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 SK_WagesID="&Rs(0,i)&""
RsAG.open SqlAG,Conn,1,1
if RsAG("AG")<>"" then
iAG=RsAG("AG")
response.write"<font color=blue>"&formatnumber(RsAG("AG"),2)&"</font>"
else
iAG="0"
response.write"<font color=blue>0</font>"
end if
RsAG.close
set RsAG=Nothing
%></td>
<td <%if i mod 2 = 0 then%>class="SK_Text"<%else%>class="SK_Texttwo"<%end if%>><%
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 SK_WagesID="&Rs(0,i)&""
RsBG.open SqlBG,Conn,1,1
if RsBG("BG")<>"" then
iBG=RsBG("BG")
response.write"<font color=red>"&formatnumber(RsBG("BG"),2)&"</font>"
else
iBG="0"
response.write"<font color=red>0</font>"
end if
RsGG.close
set RsBG=Nothing
%></td>
<td <%if i mod 2 = 0 then%>class="SK_Text"<%else%>class="SK_Texttwo"<%end if%>><%=formatnumber((iAG-iBG),2)%></td>
<td <%if i mod 2 = 0 then%>class="SK_Text"<%else%>class="SK_Texttwo"<%end if%>><%
set RsFuser=server.createobject("adodb.recordset")
SqlFuser="select * from SK_SystemUsers where UsersID="&Rs(4,i)&""
RsFuser.open SqlFuser,conn,1,1
Response.write""&RsFuser("SK_OName")&""
RsFuser.close
set RsFuser=Nothing
%></td>
<td <%if i mod 2 = 0 then%>class="SK_Text"<%else%>class="SK_Texttwo"<%end if%>>
<%
if Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK700000702") then
Response.write"<a href=""javascript:void(0)"" onClick=""javascript:var win=window.open('SK.ModWages.asp?id="&Rs(0,i)&"','Mod','width=820,height=400,top=170,left=161,center:yes,status:no,help:no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes'); win.focus()""><img src=""../images/mod.gif"" /></a>"
else
Response.write"<img src=""../images/nomod.gif"">"
end if
%></td>
</tr>
<%next%>
</form>
<tr>
<td colspan="9" class="SK_Text">
<%if Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK700000706") then%>
<input type="button" name="Del" value="删除" class="button1" onClick="if (confirm('温馨提示:删除后的数据将无法恢复,是否要继续?')){sh(2)}" />
<%end if%>

<%if Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK700000707") then%>
<input type="button" name="HF" value="恢复" class="button1" onClick="if (confirm('温馨提示:恢复后的数据将列表显示,是否要继续?')){sh(1)}" />
<%end if%>
</td>
</tr>

<tr>
<td colspan="9" class="SK_Text"><%Response.Write nav%></td>
</tr>
</table>
<%
end if
%>
</td>
<td width="8" background="../images/tab_15.gif"></td>
</tr>
</table></td>
</tr>
<tr>
<td class="SK_Td_Foot">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" height="20"><img src="../images/tab_18.gif" width="12" height="20" /></td>
<td width="98%" class="SK_Td_Page"></td>
<td width="1%"><img src="../images/tab_20.gif" width="16" height="20" /></td>
</tr>
</table>

</td>
</tr>
</TBODY>
</table>
</body>
<%
Page = Null
Set Page = Nothing
Call CloseDB()
%>
</html>