<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"),"SK700000701")))) 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()

'Mod
if RQ("Action")="Mod" and F("S_Title")<>"" and F("S_Feet")<>"" and F("S_Atime")<>""then
Call ChkIsOuter()
set rs=server.createobject("adodb.recordset")
sql="select * from SK_Wages where WagesID="&JCID(F("ID"))&""
rs.open sql,conn,1,3
rs("SK_Title")=NoCSSHackInput(F("S_Title"))
rs("SK_Feet")=NoCSSHackInput(F("S_Feet"))
rs("SK_Atime")=NoCSSHackInput(F("S_Atime"))
rs("SK_Content")=NoCSSHackContent(F("S_Content"))
rs("SK_Editor")=Session("UID")
rs("SK_Etime")=Now()
rs.Update
rs.Close 
set rs=Nothing

for K=1 to Cint(F("ToNum"))
if F("BID"&K)<>"" then 
set rs1=server.createobject("adodb.recordset")
sql1="select * from SK_WagesDetail Where WagesDetailID="&F("Bid"&K)&""
rs1.open sql1,conn,1,3
'--------------------------------------------------------
rs1("SK_AA1")=F("S_AA"&K)
rs1("SK_AA2")=F("S_AB"&K)
rs1("SK_AA3")=F("S_AC"&K)
rs1("SK_AA4")=F("S_AD"&K)
rs1("SK_AA5")=F("S_AE"&K)
rs1("SK_AA6")=F("S_AF"&K)
rs1("SK_AA7")=F("S_AG"&K)
rs1("SK_AA8")=F("S_AH"&K)
rs1("SK_AA9")=F("S_AI"&K)
rs1("SK_AA10")=F("S_AJ"&K)

rs1("SK_BB1")=F("S_BA"&K)
rs1("SK_BB2")=F("S_BB"&K)
rs1("SK_BB3")=F("S_BC"&K)
rs1("SK_BB4")=F("S_BD"&K)
rs1("SK_BB5")=F("S_BE"&K)
rs1("SK_BB6")=F("S_BF"&K)
rs1("SK_BB7")=F("S_BG"&K)
rs1("SK_BB8")=F("S_BH"&K)
rs1("SK_BB9")=F("S_BI"&K)
rs1("SK_BB10")=F("S_BJ"&K)
'--------------------------------------------------------
rs1.Update
rs1.Close
set rs1=Nothing
end if
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")="修改员工工资："&NoCSSHackInput(F("S_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
Response.Write("<script LANGUAGE='javascript'>alert('恭喜你,操作成功！');window.close();window.opener.location.reload();</script>")
Response.End
end if
%>
<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 language="javascript" src="../Inc/Check.js"></script>
<script language="javascript" src="../Inc/Calendar.js"></script>
<script language="javascript" src="../Inc/jquery.js"></script>
<SCRIPT language=javascript src="../inc/Openwin.js"></SCRIPT>
<script>
window.onbeforeunload = function()
{
if (document.body.offsetWidth-50 < event.clientX && event.clientY<0)
{
return "是否关闭当前窗口？关闭本窗口将放弃修改信息！";
}
}
</script>
<style type="text/css">
<!--
body {
margin: 5px 0px 5px 0px;
overflow-x: hidden;
}
-->
</style>
<SCRIPT language=JavaScript>
function Form1_Validator(theForm)
{

if(form1.S_Title.value ==""){
alert("对不起,工资主题不能为空!");
form1.S_Title.focus();
return false;
}

if(form1.S_Feet.value ==""){
alert("对不起,请选择发放状态!");
form1.S_Feet.focus();
return false;
}

if(form1.S_Atime.value ==""){
alert("对不起,发放日期不能为空!");
form1.S_Atime.focus();
return false;
}

return true;
}
</SCRIPT>
</head>
<body>
<table width="99%" 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">
<tr>
<td width="8" background="../images/tab_12.gif"></td>
<td>

<form name="thisForm" id="form1" method="post" action="?Action=Mod" onSubmit="return Form1_Validator(this)"> 
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="b5d6e6">
<tr>
  <td width="14%" class="SK_Text2">工资主题</td>
  <td class="SK_Text1"><input name="S_Title" type="text" size="40" value="<%=Rs("SK_Title")%>"> <font color=red>*</font></td>
  </tr>
  
<tr>
  <td class="SK_Text2">发放状态</td>
  <td class="SK_Text1"><select name="S_Feet">
    <option value="0" <%if Rs("SK_Feet")="0" then Response.Write("selected=""selected""")%>>未发放</option>
    <option value="1" <%if Rs("SK_Feet")="1" then Response.Write("selected=""selected""")%>>已发放</option>
  </select> <font color=red>*</font></td>
</tr>

<tr>
  <td class="SK_Text2">发放日期</td>
  <td class="SK_Text1"><input name="S_Atime" type="text" size="12" value="<%=Rs("SK_Atime")%>" onClick="new Calendar().show(this);" readOnly /> <font color=red>*</font></td>
</tr>

<tr>
  <td valign="top" class="SK_Text2">备注</td>
  <td class="SK_Text1"><IFRAME ID="eWebEditor1" SRC="<%=getconfig("SK_EditorPath")%>/ewebeditor.htm?id=S_Content&style=mini" FRAMEBORDER="0" SCROLLING="no" WIDTH="600" HEIGHT="300"></IFRAME>
<input type="hidden" name="S_Content" value="<%=Rs("SK_Content")%>"></td>
</tr>

<tr>
  <td colspan="2" class="SK_Title1">工资列表</td>
</tr>
<tr>
  <td colspan="2" class="SK_Text">
<!--工资列表开始-->
<%
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%" border=1 align="center" cellPadding=1 cellSpacing=0 borderColor=#ffffff borderColorLight=#dfdfdf borderColorDark=#ffffff>
<tr>
<th width="6%" class="Pheadtd">员工姓名</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=""Pheadtd"">"&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=""Pheadtdred"">"&rscc("SK_WName")&"</th>"
rscc.movenext
wend
rscc.close
Set rscc=Nothing
%>
</tr>
<%
J=0
while not rsYg.eof
J=J+1
%>
<tr>
<td class="Ptetd">
<input name="BID<%=J%>" type="hidden" value="<%=rsYg("WagesDetailID")%>">
<input name="S_UID<%=J%>" type="hidden" value="<%=rsYg("SK_UsersID")%>">
<%
set rsau=Server.createobject("adodb.recordset")
sqlau="select * from SK_SystemUsers where UsersID="&rsYg("SK_UsersID")&""
rsau.open sqlau,conn,1,1
%>
<input name="S_Uname<%=J%>" type="text" size="10" value="<%=rsau("SK_Oname")%>" readOnly>
<%
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
if B=1 then
Str1="A"
elseif B=2 then
Str1="B"
elseif B=3 then
Str1="C"
elseif B=4 then
Str1="D"
elseif B=5 then
Str1="E"
elseif B=6 then
Str1="F"
elseif B=7 then
Str1="G"
elseif B=8 then
Str1="H"
elseif B=9 then
Str1="I"
elseif B=10 then
Str1="J"
end if
Response.write"<td class=""Ptetd""><input name=""S_A"&Str1&""&J&""" type=""text"" size=""6"" onKeyUp=""this.value=this.value.replace(/\D/g,'')"" onafterpaste=""this.value=this.value.replace(/\D/g,'')"" value="""&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

if D=1 then
Str2="A"
elseif D=2 then
Str2="B"
elseif D=3 then
Str2="C"
elseif D=4 then
Str2="D"
elseif D=5 then
Str2="E"
elseif D=6 then
Str2="F"
elseif D=7 then
Str2="G"
elseif D=8 then
Str2="H"
elseif D=9 then
Str2="I"
elseif D=10 then
Str2="J"
end if

Response.write"<td class=""Ptetd""><input name=""S_B"&Str2&""&J&""" type=""text"" size=""6"" onKeyUp=""this.value=this.value.replace(/\D/g,'')"" onafterpaste=""this.value=this.value.replace(/\D/g,'')"" value="""&rsYg("SK_BB"&D)&"""></td>"
rsdd.movenext
wend
rsdd.close
Set rsdd=Nothing
%>
</tr>
<%
rsYg.movenext
wend
%>
</table>
<%
end if
rsYg.close
Set rsYg=Nothing
dim ToNum:ToNum=J
%>
<!--工资列表结束-->
</td>
</tr>
<tr>
<td colspan="2" class="SK_Text">
<input type=hidden name="ToNum" value="<%=ToNum%>">
<input type="hidden" name="ID" value="<%=Rs("WagesID")%>" >
<INPUT class="button1" type="submit" value=" 保存 "> 
<input type="button" value=" 关闭 " onClick="window.opener.location.reload();window.close();" class="button1" /></td>
</tr>
</table>
</form>

</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>
<%
Call CloseDB()
%>
</html>