<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_Sales")="0" AND (Session("Manager")="1" OR (JudgePopedomTF(Session("UserName"),"SK300000000") AND JudgePopedomTF(Session("UserName"),"SK300000801")))) then Call ReturnError()%>
<%
if not isnumeric(JCID(F("ID"))) then Call ReturnError10()
set rs=server.createobject("adodb.recordset")
if Session("Manager")=1 or Session("Manager")=2 then
sql="SELECT * from SK_SalesOrders where OrdersID="&JCID(F("ID"))&""
elseif Session("Manager")=3 then
sql="SELECT * from SK_SalesOrders INNER JOIN SK_SystemUsers ON SK_SalesOrders.SK_SalesID=SK_SystemUsers.UsersID where SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SalesOrders.OrdersID="&JCID(F("ID"))&""
elseif Session("Manager")=4 then
sql="SELECT * from SK_SalesOrders INNER JOIN SK_SystemUsers ON SK_SalesOrders.SK_SalesID=SK_SystemUsers.UsersID where SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_SalesOrders.OrdersID="&JCID(F("ID"))&""
elseif Session("Manager")=5 then
sql="SELECT * from SK_SalesOrders INNER JOIN SK_SystemUsers ON SK_SalesOrders.SK_SalesID=SK_SystemUsers.UsersID where SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_SystemUsers.SK_Dept3="&Session("Dept3")&" and SK_SalesOrders.OrdersID="&JCID(F("ID"))&""
elseif Session("Manager")=6 then
sql="SELECT * from SK_SalesOrders where SK_SalesID="&Session("UID")&" and OrdersID="&JCID(F("ID"))&""
end if
rs.Open sql,conn,1,1

'Add
if RQ("Action")="Add" and F("S_Order")<>"" and F("S_Client")<>"" and F("S_Amount")<>"" and F("S_Atime")<>"" then
Call ChkIsOuter()

set rs=server.createobject("adodb.recordset")
sql="select * from SK_Accounts"
rs.open sql,conn,1,3
rs.AddNew
rs("SK_SalesOrders")=NoCSSHackInput(F("S_OrderID"))
rs("SK_SalesClient")=NoCSSHackInput(F("S_ClientID"))
rs("SK_Amount")=NoCSSHackInput(F("S_Amount"))
rs("SK_Atime")=NoCSSHackInput(F("S_Atime"))
rs("SK_Content")=NoCSSHackContent(F("S_Content"))
rs("SK_Feet")="0"
rs("SK_Di")="1"
rs("SK_AccTitle")="销售订单退款："&F("S_Order")&""
rs("SK_Aname")=Session("UserName")
rs("SK_SalesID")=Session("UID")
rs("SK_FinanceID")="0"
rs("SK_Addor")=Session("UserName")
rs("SK_Time")=Now()
rs("SK_Editor")="0"
rs("SK_Del")="0"
rs("SK_DelUser")="0"
rs.Update
rs.Close 
set rs=Nothing

'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
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_Order.value ==""){
alert("对不起,关联订单不能为空!");
form1.S_Order.focus();
return false;
}

if(form1.S_Client.value ==""){
alert("对不起,关联客户不能为空!");
form1.S_Client.focus();
return false;
}

if(form1.S_Amount.value ==""){
alert("对不起,退款金额不能为空!");
form1.S_Amount.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="12%" class="SK_Text2">关联订单</td>
  <td width="38%" class="SK_Text1"><input name="S_Order" type="text" size="30" value="<%=Rs("SK_OrdersNo")%>" readonly>
<input name="S_OrderID" type="hidden" value="<%=Rs("OrderID")%>"><font color=red>*</font> <a onClick="JavaScript:window.open('SK.SalesProReturned.asp','SReturned','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=820,height=400,top=176,left=161');" style="cursor:hand"><img src="../images/sclient.gif" /></a></td>
  <td width="10%" class="SK_Text2">关联客户</td>
  <td width="40%" class="SK_Text1"><input name="S_Client" type="text" size="30" value="<%
set rsClient=server.createobject("adodb.recordset")
sqlClient="select * from SK_Client where ClientID="&Rs("SK_ClientID")&""
rsClient.open sqlClient,conn,1,1
'if rsClient.eof and rsClient.bof then Call ReturnError13()
Response.write""&RsClient("SK_Wname")&""
RsClient.close
Set RsClient=Nothing
%>" readonly>
<input name="S_ClientID" type="hidden" value="<%=Rs("SK_ClientID")%>"></td>
</tr>
<tr>
  <td class="SK_Text2">退款金额</td>
  <td class="SK_Text1"><input name="S_Amount" type="text" size="20" onKeyPress="if(!this.value.match(/^[\+\-]?\d*?\.?\d*?$/))this.value=this.t_value;else this.t_value=this.value;if(this.value.match(/^(?:[\+\-]?\d+(?:\.\d+)?)?$/))this.o_value=this.value;if((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46 || /\.\d\d$/.test(value))event.returnValue=false" onKeyUp="if(!this.value.match(/^[\+\-]?\d*?\.?\d*?$/))this.value=this.t_value;else this.t_value=this.value;if(this.value.match(/^(?:[\+\-]?\d+(?:\.\d+)?)?$/))this.o_value=this.value" onBlur="if(!this.value.match(/^(?:[\+\-]?\d+(?:\.\d+)?|\.\d*?)?$/))this.value=this.o_value;else{if(this.value.match(/^\.\d+$/))this.value=0+this.value;if(this.value.match(/^\.$/))this.value=0;this.o_value=this.value};" value="<%=JYS%>"> <font color=red>*</font></td>
  <td class="SK_Text2">计划日期</td>
  <td class="SK_Text1"><input name="S_ATime" type="text" size="12" onClick="new Calendar().show(this);" value="<%=Date()%>" readOnly /> <font color=red>*</font></td>
</tr>

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

<tr>
<td colspan="4" 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>