<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_Service")="0" AND (Session("Manager")="1" OR (JudgePopedomTF(Session("UserName"),"SK600000000") AND JudgePopedomTF(Session("UserName"),"SK600000100")))) then Call ReturnError()%>
<%
Dim PriceAid
PriceAid=conn.execute("select count(*) from SK_Services where datediff(day,[SK_Time],getdate())=0")(0)
Dim PriceNN
PriceNN=PriceAid+1

'AddNew
if RQ("Action")="Add" and F("S_Di")<>"" and F("S_ClientID")<>"" and F("S_Title")<>"" and F("S_SNo")<>"" and F("S_ATime")<>"" then
Call ChkIsOuter()
set rs=server.createobject("adodb.recordset")
sql="select * from SK_Services"
rs.open sql,conn,1,3
rs.AddNew
rs("SK_Di")=NoCSSHackInput(F("S_Di"))
rs("SK_ClientID")=NoCSSHackInput(F("S_ClientID"))
rs("SK_SNo")=NoCSSHackInput(F("S_SNo"))
rs("SK_STitle")=NoCSSHackInput(F("S_Title"))
rs("SK_ATime")=NoCSSHackInput(F("S_ATime"))
rs("SK_Feet")=NoCSSHackInput(F("S_Feet"))
rs("SK_Level")=NoCSSHackInput(F("S_Level"))
rs("SK_Mode")=NoCSSHackInput(F("S_Mode"))
rs("SK_Aname")=NoCSSHackInput(F("S_Aname"))
rs("SK_NTime")=NoCSSHackInput(F("S_NTime"))
rs("SK_Content")=NoCSSHackContent(F("S_Content"))
rs("SK_Content1")=NoCSSHackContent(F("S_Content1"))
rs("SK_Content2")=NoCSSHackContent(F("S_Content2"))
rs("SK_SalesID")=Session("UID")
rs("SK_Addor")=Session("UserName")
rs("SK_Time")=Now()
rs("SK_Del")="0"

'自定义字段部分开始
set RsField=Server.createobject("adodb.recordset")
sqlField="SELECT * from SK_ServiceField where SK_Di=0 and SK_ShowOnForm=0"
RsField.Open sqlField,conn,1,1
A=0
while not RsField.eof
A=A+1
rs(""&RsField("SK_FieldName")&"")=NoCSSHackInput(F(""&RsField("SK_FieldName")&""))
RsField.movenext
wend
RsField.close
Set RsField=Nothing

set RsOption=Server.createobject("adodb.recordset")
sqlOption="SELECT * from SK_ServiceOptions where SK_Di=0 and SK_ShowOnForm=0"
RsOption.Open sqlOption,conn,1,1
B=0
while not RsOption.eof
B=B+1
rs(""&RsOption("SK_FieldName")&"")=NoCSSHackInput(F(""&RsOption("SK_FieldName")&""))
RsOption.movenext
wend
RsOption.close
Set RsOption=Nothing
'自定义字段部分结束

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")="新建客户服务："&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_Client.value ==""){
alert("对不起,请选择关联客户!");
form1.S_Client.focus();
return false;
}

if(form1.S_SNo.value ==""){
alert("对不起,客服编号不能为空!");
form1.S_SNo.focus();
return false;
}

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

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

if(form1.S_Di.value ==""){
alert("对不起,请选择客服类别!");
form1.S_Di.focus();
return false;
}

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

if(form1.S_Level.value ==""){
alert("对不起,请选择紧急程度!");
form1.S_Level.focus();
return false;
}

if(form1.S_Mode.value ==""){
alert("对不起,请选择客服方式!");
form1.S_Mode.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="35%" class="SK_Text1"><input name="S_Client" type="text" size="30" readonly>
<input name="S_ClientID" type="hidden">
 <a onClick="JavaScript:window.open('../Client/SK.SClient.asp?form=form1&field=S_Client&S_ClientID&S_Linkman&S_LinkmanID','','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> <font color=red>*</font>
 <input name="S_Linkman" type="hidden">
  <input name="S_LinkmanID" type="hidden">  </td>
  <td width="12%" class="SK_Text2">客服编号</td>
  <td width="41%" class="SK_Text1"><input name="S_SNo" type="text" size="20" value="SE<%=Year(Date())%><%=right("0"&Month(Date()),2)%><%=right("0"&Day(Date()),2)%>-<%=right(("00"&PriceNN),3)%>"> <font color=red>*</font></td>
</tr>
<tr>
  <td class="SK_Text2">客服主题</td>
  <td class="SK_Text1"><input name="S_Title" type="text" size="35"> <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);" readOnly /> <font color=red>*</font></td>
</tr>
<tr>
  <td class="SK_Text2">客服类别</td>
  <td class="SK_Text1"><select name="S_Di">
<option value="" selected>---请选择---</option>
<%
Set rsDi=Server.CreateObject("ADODB.RecordSet") 
sqlDi="SELECT * from SK_SystemCategory where SK_Di=101 order by CategoryID asc" 
rsDi.Open sqlDi,conn,1,1
do while not rsDi.eof
%><option value="<%=rsDi("CategoryID")%>"><%=rsDi("SK_Name")%></option>
<%
rsDi.movenext
loop
rsDi.close
set rs1=nothing
%></select> <font color=red>*</font></td>
  <td class="SK_Text2">客服状态</td>
  <td class="SK_Text1"><select name="S_Feet">
<option value="" selected>---请选择---</option>
<%
Set rsFeet=Server.CreateObject("ADODB.RecordSet") 
sqlFeet="SELECT * from SK_SystemCategory where SK_Di=103 order by CategoryID asc" 
rsFeet.Open sqlFeet,conn,1,1
do while not rsFeet.eof
%><option value="<%=rsFeet("CategoryID")%>"><%=rsFeet("SK_Name")%></option>
<%
rsFeet.movenext
loop
rsFeet.close
set rsFeet=nothing
%></select> <font color=red>*</font></td>
</tr>
<tr>
  <td class="SK_Text2">紧急程度</td>
  <td class="SK_Text1"><select name="S_Level">
<option value="" selected>---请选择---</option>
<%
Set rsLevel=Server.CreateObject("ADODB.RecordSet") 
sqlLevel="SELECT * from SK_SystemCategory where SK_Di=104 order by CategoryID asc" 
rsLevel.Open sqlLevel,conn,1,1
do while not rsLevel.eof
%><option value="<%=rsLevel("CategoryID")%>"><%=rsLevel("SK_Name")%></option>
<%
rsLevel.movenext
loop
rsLevel.close
set rsLevel=nothing
%></select> <font color=red>*</font></td>
  <td class="SK_Text2">客户方式</td>
  <td class="SK_Text1"><select name="S_Mode">
<option value="" selected>---请选择---</option>
<%
Set rsMode=Server.CreateObject("ADODB.RecordSet") 
sqlMode="SELECT * from SK_SystemCategory where SK_Di=102 order by CategoryID asc" 
rsMode.Open sqlMode,conn,1,1
do while not rsMode.eof
%><option value="<%=rsMode("CategoryID")%>"><%=rsMode("SK_Name")%></option>
<%
rsMode.movenext
loop
rsMode.close
set rsMode=nothing
%></select> <font color=red>*</font></td>
</tr>
<tr>
  <td class="SK_Text2">负责人员</td>
  <td class="SK_Text1"><input name="S_Aname" type="text" size="15"></td>
  <td class="SK_Text2">所用时间</td>
  <td class="SK_Text1"><input name="S_NTime" type="text" size="15"></td>
</tr>
<%
'自定义选项开始
set RsOptions=server.createobject("adodb.recordset")
sqlOptions="SELECT * from SK_ServiceOptions where SK_Di=0 and SK_ShowOnForm=0 Order by SK_OrderID asc"
RsOptions.Open sqlOptions,conn,1,1
if RsOptions.bof and RsOptions.eof then
else
%>
<tr>
  <td colspan="4" class="SK_Title1">自定义选项</td>
</tr>
<tr>
  <td colspan="4" class="SK_Text1"><%
Response.write"<table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""1"">"
for Optionsi=1 to RsOptions.recordCount '变量i从1循环到数据库中的全部记录数 
if (Optionsi mod 2 =1) then '每个tr即每行显示1个记录,可根据需要自行修改, 将左边的1修改为2即显示两行。
response.write "<tr>" 
end if
Response.write"<td class=""SK_Text2"" width=""12%"">"&RsOptions("SK_Title")&"</td><td class=""SK_Text1""><select name="&RsOptions("SK_FieldName")&">"

Set rs1=Server.CreateObject("ADODB.RecordSet") 
sql1="SELECT * from SK_ServiceOptionsDetail where SK_OptionsID="&RsOptions("FieldID")&"" 
rs1.Open sql1,conn,1,1
Response.write"<option value="""" selected>--请选择--</option>"
do while not rs1.eof
Response.write"<option value="&rs1("OptionsDetailID")&">"&rs1("SK_OName")&"</option>"
rs1.movenext
loop
rs1.close
set rs1=nothing

Response.write"</select></td>"
if (Optionsi mod 2 = 0) then '每个tr即每行显示1个记录,可根据需要自行修改, 将左边的1修改为2即显示两行。
response.write "</tr>" 
end if 
RsOptions.movenext
next 
Response.write"</table>"
%>
</td>
</tr>
<%
end if
RsOptions.close
set RsOptions=Nothing
'自定义选项结束
'自定义字段开始
set RsFields=server.createobject("adodb.recordset")
sqlFields="SELECT * from SK_ServiceField where SK_Di=0 and SK_ShowOnForm=0 Order by SK_OrderID asc"
RsFields.Open sqlFields,conn,1,1
if RsFields.bof and RsFields.eof then
else
%>
<tr>
  <td colspan="4" class="SK_Title1">自定义字段</td>
</tr>
<tr>
  <td colspan="4" class="SK_Text1">
<%
Response.write"<table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""1"">"
for Fieldsi=1 to RsFields.recordCount '变量i从1循环到数据库中的全部记录数 
if (Fieldsi mod 2 =1) then '每个tr即每行显示1个记录,可根据需要自行修改, 将左边的1修改为2即显示两行。
response.write "<tr>" 
end if
Response.write"<td class=""SK_Text2"" width=""12%"">"&RsFields("SK_Title")&"</td><td class=""SK_Text1""><input type=""text"" size=""20"" name="&RsFields("SK_FieldName")&" title="&RsFields("SK_Tips")&"></td>"
if (Fieldsi mod 2 = 0) then '每个tr即每行显示1个记录,可根据需要自行修改, 将左边的1修改为2即显示两行。
response.write "</tr>" 
end if 
RsFields.movenext 
next 
Response.write"</table>"
%>
</td>
</tr>
<%
end if
RsFields.close
set RsFields=Nothing
'自定义字段结束
%>
<tr>
  <td colspan="4" class="SK_Title1">备注描述</td>
</tr>
<tr>
  <td valign="top" class="SK_Text2">客服描述</td>
  <td colspan="3" 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 valign="top" class="SK_Text2">处理意见</td>
  <td colspan="3" class="SK_Text1"><IFRAME ID="eWebEditor1" SRC="<%=getconfig("SK_EditorPath")%>/ewebeditor.htm?id=S_Content1&style=mini" FRAMEBORDER="0" SCROLLING="no" WIDTH="600" HEIGHT="200"></IFRAME>
<input type="hidden" name="S_Content1"></td>
</tr>
<tr>
  <td valign="top" class="SK_Text2">处理结果</td>
  <td colspan="3" class="SK_Text1"><IFRAME ID="eWebEditor1" SRC="<%=getconfig("SK_EditorPath")%>/ewebeditor.htm?id=S_Content2&style=mini" FRAMEBORDER="0" SCROLLING="no" WIDTH="600" HEIGHT="200"></IFRAME>
<input type="hidden" name="S_Content2"></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>