⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.asp

📁 统架构:ASP+ACCESS 版本系列:个人版 开发时间:2005年12月20日 开发者: 搏天网络 联系QQ:359042595 演示地址:http://www.bootweb.cn/oa
💻 ASP
字号:
<%Option Explicit%>
<!--#include file="config.asp"-->
<%
If session("admin")<>"ok" Then
 response.redirect"index.asp"
Else

Dim searchKey,searchCompany,searchName,searchTelephone,searchDemo
searchKey=trim(request.form("searchKey"))
searchCompany=trim(request.form("searchCompany"))
searchName=trim(request.form("searchName"))
searchTelephone=trim(request.form("searchTelephone"))
searchDemo=trim(request.form("searchDemo"))

Dim recycle,Id
recycle=request("recycle")
If recycle="" Then recycle=0

Dim PageNo
PageNo=request("PageNo")
If PageNo="" Then PageNo=1

Sub ShowCustomer(objRS,PageNo)
 objRS.AbsolutePage=PageNo
 Dim I
 For I=1 To rsPage
  response.write"<tr>"
  'response.write"<td align='center'><input type='checkbox' name='CustCheck' value='"&objRS("Id")&"'></td>"
  response.write"<td align='left'>&nbsp;<input type='checkbox' name='CustCheck' value='"&objRS("Id")&"'>"
  If objRS("VIP")=3 Then
  response.write "<a title='"&objRS("Company")&"' onclick=""winOpen('viewcustomer.asp?Id="&objRS("Id")&"')"" style='cursor:hand'><font color='#ff0000'>"&Left(objRS("Company"),13)&"</font></a>"
  ElseIf objRS("VIP")=2 Then
  response.write "<a title='"&objRS("Company")&"' onclick=""winOpen('viewcustomer.asp?Id="&objRS("Id")&"')"" style='cursor:hand'><font color='#008000'>"&Left(objRS("Company"),13)&"</font></a>"
  ElseIf objRS("VIP")=1 Then
  response.write "<a title='"&objRS("Company")&"' onclick=""winOpen('viewcustomer.asp?Id="&objRS("Id")&"')"" style='cursor:hand'><font color='#000000'>"&Left(objRS("Company"),13)&"</font></a>"
  End If
  response.write"</td>"
  response.write"<td align='center'>"&Left(objRS("Name"),5)&"</td>"
  response.write"<td align='center'>"&Left(objRS("Title"),5)&"</td>"
  response.write"<td align='center'>"&Left(objRS("Tel1"),8)&"</td>"
  response.write"<td align='center'>"&Left(objRS("Date1"),10)&"</td>"
  response.write"<td align='center'><a href='editcustomer.asp?Id="&objRS("Id")&"'>编辑</a></td>"
  response.write"</tr>"
  objRS.MoveNext
  If objRS.EOF Then Exit For
 Next
End Sub
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title><%=title%></title>
<style type="text/css">
td{font-size:10pt;font-family:宋体;color:#000000;height:30px}
input{border:0}
</style>
<SCRIPT language=JavaScript>
<!--
function winOpen(url){
  window.open(url,'','width=520,height=500,left=30,top=50,scrollbar=auto');
}

function check(id){
 var isChecked = false;
 for (var i=0;i<document.CustForm.elements.length;i++){
  //var e = document.CustForm.elements[i];
  if (document.CustForm.elements[i].name == 'CustCheck'){
     if (document.CustForm.elements[i].checked == true){
     isChecked = true;
     break;
     }
  }
  //return isChecked;
 }
 if(!isChecked){
 alert("请先选择客户!");
 return false;
 }
 
 document.CustForm.target="_self";
 
 if(id==1){
   if(confirm("你确定要将选中的客户放入回收站吗?")==true){
   document.CustForm.action="del.asp";
   document.CustForm.submit();
   }
 }
 
 if(id==2){
   if(confirm("你确定要将选中的客户彻底删除吗(不可恢复)?")==true){
   document.CustForm.action="del.asp";
   document.CustForm.submit();
   }
 }
 
 if(id==3){
   if(confirm("你确定要将选中的客户资料还原吗?")==true){
   document.CustForm.action="del.asp";
   document.CustForm.submit();
   }
 }
 

}

function delConfirm(){
 //if(id==4){
   if(confirm("你确定要清空回收站吗?")==true){
   document.CustForm.action="del.asp";
   document.CustForm.submit();
   }
 //}
}

function CheckAll(f)
  {
  for (var i=0;i<f.elements.length;i++)
    {
    var e = f.elements[i];
    if (e.name == 'CustCheck')
       if (e.checked == false){
       e.checked = true;
       }else{
       e.checked = false;
       }
    }
  }
//-->
</SCRIPT>
</head>

<body topmargin=0 leftmargin=0 bgcolor="#000000">
<table width="750" align="center" bordre=0 bgcolor="#ffffff"><tr><td width="100%">

<table align="center" border=0 width="98%" cellspacing=0 cellpadding=0>
 <tr>
  <td width="100%" align="center" valign="middle" style="font-size:11pt"><b><%=cnVersion%></b></td>
 </tr>
</table>
<table align="center" border=1 width="98%" cellspacing="0" cellpadding="0" bordercolorlight="#ffffff" bordercolordark="#999999">
 <form name="searchForm" method="post">
 <tr>
  <td colspan=6 align="right" valign="middle">请输入查询关键字:
  <input type="text" name="searchKey" style="border:1 solid #cccccc">&nbsp;
  <!--
  <select name="searchField">
   <option value="searchCompany" selceted>单位名称</option>
   <option value="searchName">联系人</option>
   <option value="searchTelephone">联系电话</option>
   <option value="searchDemo">备注</option>
  </select>&nbsp;-->
  <input type="submit" value="查找" style="border:1px solid #000000">&nbsp;&nbsp;
  </td>
 </tr>
 </form>
 <form name="CustForm" method="post">
 <tr bgcolor="#D4D0C8">
  <td colspan=7 align="left">&nbsp;&nbsp;
  <input type="button" value="·全选/反选·" onclick="return CheckAll(CustForm)">
  <%If recycle<>1 Then%>
  <input type="submit" name="s1" value="·删除·" onclick="return check(1);">
  <%End If%>
  <%If recycle=1 Then%>
  <input type="submit" name="s3" value="·还原·" onclick="return check(3);">
  <%End If%>
  <input type="submit" name="s2" value="·彻底删除·" onclick="return check(2);">&nbsp;&nbsp;
  <%If recycle<>1 Then%>
  <a href="main.asp?recycle=1">回收站</a>&nbsp;&nbsp;  
  <a href="addcustomer.asp">添加新客户</a>&nbsp;&nbsp;
  <%ElseIf recycle=1 Then%>  
  <input type="submit" name="s4" value="·清空·" onclick="return delConfirm();">&nbsp;&nbsp;
  <a href="main.asp">返回</a>&nbsp;&nbsp;
  <%End If%>
  <a href="exit.asp">退出系统</a>
  </td>
 </tr>
 <tr bgcolor="#D4D0C8">
  <td align="center" valign="middle" width="30%">单位名称</td>
  <td align="center" valign="middle" width="20%">联系人</td>
  <td align="center" valign="middle" width="10%">职务</td>
  <td align="center" valign="middle" width="10%">办公电话</td>
  <td align="center" valign="middle" width="20%">加入时间</td>
  <td align="center" valign="middle" width="10%">编辑</td>
 </tr>
 <!--#include file="conn.asp"-->
 <%
 Dim objRS,strSQL
 set objRS=Server.CreateObject("ADODB.Recordset")
 If recycle=1 Then 
 strSQL="select Id,Company,Name,Title,Tel1,VIP,Date1 from customer where Delete=1 and (Company like '%"&searchKey&"%' or Name like '%"&searchKey&"%' or Tel1 like '%"&searchKey&"%' or Tel2 like '%"&searchKey&"%' or Demo like '%"&searchKey&"%') order by VIP desc,Date1 desc"
 Else
 strSQL="select Id,Company,Name,Title,Tel1,VIP,Date1 from customer where Delete=0 and (Company like '%"&searchKey&"%' or Name like '%"&searchKey&"%' or Tel1 like '%"&searchKey&"%' or Tel2 like '%"&searchKey&"%' or Demo like '%"&searchKey&"%') order by VIP desc,Date1 desc"
 End If
 objRS.Open strSQL,objConn,1,3
 
 Dim rsCount,rsPage,pageCount,pageMode
 rsCount=objRS.RecordCount
 objRS.PageSize=13      '设置每页记录数
 rsPage=objRS.PageSize '设置每页记录数

 If rsCount>0 Then
 pageCount=objRS.PageCount
 ShowCustomer objRS,PageNo
 Else
 response.write"<tr>"
 'If recycle=1 Then
 response.write"<td width='100%' align='left' colspan=7>&nbsp;&nbsp;当前没有任何客户记录!</td>"
 response.write"</tr>"
 End If
 %>
 <tr bgcolor="#D4D0C8">
  <td colspan=7 align="left">&nbsp;&nbsp;
  <input type="button" value="·全选/反选·" onclick="return CheckAll(CustForm)">
  <%If recycle<>1 Then%>
  <input type="submit" name="s1" value="·删除·" onclick="return check(1);">
  <%End If%>
  <%If recycle=1 Then%>
  <input type="submit" name="s3" value="·还原·" onclick="return check(3);">
  <%End If%>
  <input type="submit" name="s2" value="·彻底删除·" onclick="return check(2);">&nbsp;&nbsp;
  <%If recycle<>1 Then%>
  <a href="main.asp?recycle=1">回收站</a>&nbsp;&nbsp;  
  <a href="addcustomer.asp">添加新客户</a>&nbsp;&nbsp;
  <%ElseIf recycle=1 Then%>
  <input type="submit" name="s4" value="·清空·" onclick="return delConfirm();">&nbsp;&nbsp;
  <a href="main.asp">返回</a>&nbsp;&nbsp;
  <%End If%>
  <a href="exit.asp">退出系统</a>
  </td>
 </tr>
  <%
If pageCount>1 Then 
 response.write"<form name='jumpPage' method='post' action='?'>"
 response.write"<tr bgcolor='#D4D0C8'>"
 response.write"<td colspan=7 align='right'>"
 response.write"每页<font color='#ff0000'>"&rsPage&"</font>条,当前<font color='#ff0000'>"&PageNo&"</font>/"&pageCount&"页&nbsp;"
 If Int(PageNo)>1 Then
  response.write"<a href='?recycle="&recycle&"&PageNo=1'>首页</a>&nbsp;&nbsp;"
  response.write"<a href='?recycle="&recycle&"&PageNo="&PageNo-1&"'>上页</a>&nbsp;&nbsp;"
 End If
 If Int(PageNo)>=1 And Int(PageNo)<pageCount Then
  response.write"<a href='?recycle="&recycle&"&PageNo="&PageNo+1&"'>下页</a>&nbsp;&nbsp;"
  response.write"<a href='?recycle="&recycle&"&PageNo="&pageCount&"'>尾页</a>"
 End If
 response.write"&nbsp;&nbsp;"
 response.write"转到第<input type='text' name='PageNo' style='width:20px;border:1px solid #000000'>页"
 response.write"<input type='submit' value='>>>'>"
 response.write"</td>"
 response.write"</tr>"
 response.write"</form>"
End If
  %>
 </form>
</table>
<table align="center" border=0 width="98%" cellspacing=0 cellpadding=0>
 <tr>
  <td width="100%" align="center" valign="middle" style="font-size:10pt"><%=bottom%></td>
 </tr>
</table>
</td></tr></table>
</body>

</html>
<%
End If
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -