<%response.expires=0%>
<!--#include file="asp/sqlstr.asp"-->
<!--#include file="asp/bgsub.asp"-->
<!--#include file="asp/opendb.asp"-->
<!--#include file="asp/checked.asp"-->
<%
function strlength(inputstr)
dim length,i
length=0
for i=1 to len(inputstr)
if asc(mid(inputstr,i,1))<0 then
length=length+2
else
length=length+1
end if
next
strlength=length
end function
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
if oabusyusername="" then
response.write("<script language=""javascript"">")
response.write("window.top.location.href='default.asp';")
response.write("</script>")
response.end
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css/css.css">
<script language="vbscript">
sub checkkey()
if window.event.keyCode >57 or window.event.keyCode <48 then
if window.event.keyCode<>45 and window.event.keyCode<>40 and window.event.keyCode<>41 then
window.event.keyCode=0
end if
end if
end sub
</script>
<title></title>
<body bgcolor="#ffffff" topmargin="5" leftmargin="5">
<center>
<table align="center">
<tr>
<td><b>输入客户联系人资料</b> </td>
<form method="post" action="tel_notebook.asp">
<td><input type="submit" value="返回">
</td>
</form>
</tr>
</table>
</center>
<%
if request("submit")="输入" then
errorinfo=""
name=request("name")
if strlength(name)>10 then
errorinfo=errorinfo&"客户姓名太长,不能超过5个汉字!<br>"
end if
company=request("company")
if strlength(company)>50 then
errorinfo=errorinfo&"所在单位太长,不能超过25个汉字!<br>"
end if
project=request("project")
if strlength(project)>50 then
errorinfo=errorinfo&"业务项目太长,不能超过25个汉字!<br>"
end if
if errorinfo="" then
set conn=opendb("oabusy","conn","accessdsn")
sql = "Insert Into telinf (name,company,project,use,remark) Values( "
sql = sql & SqlStr(name) & ", "
sql = sql & SqlStr(company) & ", "
sql = sql & SqlStr(project) & ", "
sql = sql & SqlStr(use) & ", "
sql = sql & SqlStr(remark) & ")"
conn.Execute sql
conn.close
set conn=nothing
%>
<br><br>
<center>
<font color="red" size="+1">
成功输入客户信息!
</font>
</center>
<br><br>
<%
else
%>
<div align="center">
<table widht="80%" border="0">
<tr><td>
<center><b><font color="red" size="+1">出错了</font></b></center><br><br>
<font color="#ee0000" size="+1"><%=errorinfo%></font>
<center><input type="button" value="返回" onClick="javascript:history.go( -1 );return true;"></center>
</td></tr></table>
</div>
<%
end if
else
%>
<script Language="JavaScript">
function form_check()
{
var l1=document.form1.name.value.length;
if(l1==0)
{
window.alert("客户姓名必须填");
document.form1.name.focus();
return (false);
}
var l2=document.form1.company.value.length;
if(l2==0)
{
window.alert("客户所在单位必须填");
document.form1.company.focus();
return (false);
}
var l3=document.form1.project.value.length;
if(l3==0)
{
window.alert("业务项目必须填");
document.form1.project.focus();
return (false);
}
var l4=document.form1.remark.value.length;
if(l4==0)
{
window.alert("电话记录必须填");
document.form1.remark.focus();
return (false);
}
}
</script>
<center>
<br>
<form method="post" action="addtelinf.asp" name="form1" onSubmit="javascript:return form_check();">
<table border="1" cellpadding="5" cellspacing="0" width="54%" bordercolorlight="#808080" bordercolordark="#1083CE">
<tr>
<td width="15%" align=center><b>联 系 人</b></td>
<td bgcolor="#FFFFFF"><select size=1 name="name">
<option value="请选择联系人" selected>请选择联系人</option>
<%
set conn=opendb("oabusy","conn","accessdsn")
set rs=server.createobject("adodb.recordset")
sql="select * from clientinf"
rs.open sql,conn,1
while not rs.eof and not rs.bof
%>
<option value="<%=rs("name")%>"><%=rs("name")%></option>
<%
rs.movenext
wend
%>
</select>
<font color=red>*</font></td>
</tr>
<tr>
<td align=center><b>客户单位</b></td>
<td bgcolor="#FFFFFF"><select size=1 name="company">
<option value="请从列表中选择客户单位" selected>请从列表中选择客户单位</option>
<%
set conn=opendb("oabusy","conn","accessdsn")
set rs=server.createobject("adodb.recordset")
sql="select * from dept1"
rs.open sql,conn,1
while not rs.eof and not rs.bof
%>
<option value="<%=rs("dept")%>"><%=rs("dept")%></option>
<%
rs.movenext
wend
%>
</select>
<font color=red>*</font></td>
</tr>
<tr>
<td align=center><b>业务项目</b></td>
<td bgcolor="#FFFFFF"><label>
<select name="project" size=1>
<option value="请选择项目" selected>请选择项目</option>
<%
set conn=opendb("oabusy","conn","accessdsn")
set rs=server.createobject("adodb.recordset")
sql="select * from userlevel1"
rs.open sql,conn,1
while not rs.eof and not rs.bof
%>
<option value="<%=rs("userlevel")%>"><%=rs("userlevel")%></option>
<%
rs.movenext
wend
%>
</select>
</label>
<font color=red>*</font></td>
</tr>
<tr>
<td align=center><b>添 加 者</b></td>
<td bgcolor="#FFFFFF"><input type=text name="use" value="<%response.write(""&oabusyname&"")%>" size=13> </td>
<tr>
<td align=center><b>电话记录</b></td>
<td bgcolor="#FFFFFF"><textarea rows="8" cols="61" name="remark"></textarea><font color=red>*</font></td>
</table>
<font color=red>*</font>必须填写
<input type="submit" name="submit" value="输入"> <input type="button" value="返回" onClick="javascript:window.location.href='tel_notebook.asp';">
</form>
</center>
<%
end if
%>
<%
%>
</body>