<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()%>
<%
'AddNew
if RQ("Action")="Add" 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"
rs.open sql,conn,1,3
rs.AddNew
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_SalesID")=Session("UID")
rs("SK_Addor")=Session("Oname")
rs("SK_Time")=Now()
rs("SK_Del")="0"
rs.Update

set rs=conn.execute("select @@IDENTITY")
GetNewID=rs(0)

rs.Close 
set rs=Nothing

if request("S_Uname").count>0 then
for i =1 to request("S_Uname").count
set rs1=server.createobject("adodb.recordset")
sql1="select * from SK_WagesDetail"
rs1.open sql1,conn,1,3
rs1.AddNew
'--------------------------------------------------------
rs1("SK_WagesID")=GetNewID
rs1("SK_UsersID")=request("S_UID")(i)
rs1("SK_AA1")=request("S_AA1")(i)
rs1("SK_AA2")=request("S_AA2")(i)
rs1("SK_AA3")=request("S_AA3")(i)
rs1("SK_AA4")=request("S_AA4")(i)
rs1("SK_AA5")=request("S_AA5")(i)
rs1("SK_AA6")=request("S_AA6")(i)
rs1("SK_AA7")=request("S_AA7")(i)
rs1("SK_AA8")=request("S_AA8")(i)
rs1("SK_AA9")=request("S_AA9")(i)
rs1("SK_AA10")=request("S_AA10")(i)
rs1("SK_BB1")=request("S_BB1")(i)
rs1("SK_BB2")=request("S_BB2")(i)
rs1("SK_BB3")=request("S_BB3")(i)
rs1("SK_BB4")=request("S_BB4")(i)
rs1("SK_BB5")=request("S_BB5")(i)
rs1("SK_BB6")=request("S_BB6")(i)
rs1("SK_BB7")=request("S_BB7")(i)
rs1("SK_BB8")=request("S_BB8")(i)
rs1("SK_BB9")=request("S_BB9")(i)
rs1("SK_BB10")=request("S_BB10")(i)
'--------------------------------------------------------
rs1.Update
rs1.Close
set rs1=Nothing
next
end if

'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=Add" 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"> <font color=red>*</font></td>
  </tr>
  
<tr>
  <td class="SK_Text2">发放状态</td>
  <td class="SK_Text1"><select name="S_Feet">
    <option  value="" selected>--请选择--</option>
    <option value="0">未发放</option>
    <option value="1">已发放</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" 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"></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_SystemUsers where SK_Incum=0 order by UsersID 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="S_UID" type="hidden" value="<%=rsYg("UsersID")%>"><input name="S_Uname" type="text" size="10" value="<%=rsYg("SK_Oname")%>" readOnly></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=""Ptetd""><input name=""S_AA"&B&""" type=""text"" size=""6"" onKeyUp=""this.value=this.value.replace(/\D/g,'')"" onafterpaste=""this.value=this.value.replace(/\D/g,'')""></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=""Ptetd""><input name=""S_BB"&D&""" type=""text"" size=""6"" onKeyUp=""this.value=this.value.replace(/\D/g,'')"" onafterpaste=""this.value=this.value.replace(/\D/g,'')""></td>"
rsdd.movenext
wend
rsdd.close
Set rsdd=Nothing
%>
</tr>
<%
rsYg.movenext
wend
%>
</table>
<%
end if
rsYg.close
Set rsYg=Nothing
%>
<!--工资列表结束-->
</td>
</tr>
<tr>
<td colspan="2" class="SK_Text">
<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>