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

📄 dataform.asp

📁 WEB客户管理系统+小型OA系统。一个不错的程序
💻 ASP
📖 第 1 页 / 共 3 页
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Option Explicit
Response.Buffer = True
Response.Expires = 0
Response.Expiresabsolute = Now() - 1 
Response.AddHeader "pragma","no-cache" 
Response.AddHeader "cache-control","private" 
Response.CacheControl = "no-cache"
%>
<!--#include file="Connections/conn.asp" -->

<!--登录权限判断,Session和MD5加密判断-->
<%
Rem Session("CRM_account") 用户帐号
Rem Session("CRM_name") 用户名
Rem Session("CRM_level") 用户等级

If Session("CRM_account") = "" Or Session("CRM_name") = "" Or Session("CRM_level") <= 0 Then Response.Redirect("login.asp")

''生成下拉列表
Function getList(i,sTable,iId,sValue,sName,selfValue)
    If i < 1 Or i > 2 Then
	    getList = ""
		Exit Function
	End If
	Dim strList
	Dim rs
	If i = 1 Then
	    strList = "<select name=""" & sName & """ selfValue=""" & selfValue & """>"
		strList = strList & "<option value="""">请选择</option>"
		Set rs = Server.CreateObject("ADODB.Recordset")
		rs.Open "Select * From " & sTable & "",conn,3,1
		Do While Not rs.BOF And Not rs.EOF
		    strList = strList & "<option value=""" & rs(sValue) & """>" & rs(sValue) & "</option>"
			rs.MoveNext
		Loop
		rs.Close
		Set rs = Nothing
		strList = strList & "</select>"
		getList = strList
	Else
	    strList = "<select name=""" & sName & """ selfValue=""" & selfValue & """>"
		strList = strList & "<option value="""">请选择</option>"
		Set rs = Server.CreateObject("ADODB.Recordset")
		rs.Open "Select * From " & sTable & "",conn,3,1
		Do While Not rs.BOF And Not rs.EOF
		    strList = strList & "<option value=""" & rs(iId) & """>" & rs(sValue) & "</option>"
			rs.MoveNext
		Loop
		rs.Close
		Set rs = Nothing
		strList = strList & "</select>"
		getList = strList
	End If
End Function

Function getUserList(intLevel,intGroup)
    Dim rs,strUserList
	strUserList = "'" & Session("CRM_name") & "'"
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.Open "Select * From baidu_user Where uLevel < " & intLevel & " And uGroup = " & intGroup,conn,3,1
	Do While Not rs.BOF And Not rs.EOF
	    If strUserList = "" Then
		    strUserList = "'" & rs("uName") & "'"
		Else
		    strUserList = strUserList & ",'" & rs("uName") & "'"
		End If
		rs.MoveNext
	Loop
	rs.Close
	Set rs = Nothing
	getUserList = strUserList
End Function

Function getUserList2(intLevel,intGroup)
    Dim rs,strUserList
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.Open "Select * From baidu_user Where uLevel < " & intLevel & " And uGroup = " & intGroup,conn,3,1
	Do While Not rs.BOF And Not rs.EOF
	    If strUserList = "" Then
		    strUserList = "'" & rs("uName") & "'"
		Else
		    strUserList = strUserList & ",'" & rs("uName") & "'"
		End If
		rs.MoveNext
	Loop
	rs.Close
	Set rs = Nothing
	getUserList2 = strUserList
End Function

Function IsAccessUser(strUserList,strUser)
    Dim arrUserList,k,flag
	flag = 0
	arrUserList = Split(strUserList,",")
	For k = 0 To UBound(arrUserList) - 1
	    If Replace(arrUserList(k),"'","") = strUser Then
		    flag = 1
			Exit For
		End If
	Next
	If flag = 1 Then
	    IsAccessUser = True
	Else
	    IsAccessUser = False
	End If
End Function

Function getGroupUserList(intGroup)
    Dim rs,strUserList
	strUserList = "'" & Session("CRM_name") & "'"
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.Open "Select * From baidu_user Where uGroup = " & intGroup,conn,3,1
	Do While Not rs.BOF And Not rs.EOF
	    If strUserList = "" Then
		    strUserList = "'" & rs("uName") & "'"
		Else
		    strUserList = strUserList & ",'" & rs("uName") & "'"
		End If
		rs.MoveNext
	Loop
	rs.Close
	Set rs = Nothing
	getGroupUserList = strUserList
End Function

Function getClientsList(strSql)
    Dim rs,strClientsList
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.Open strSql,conn,3,1
	Do While Not rs.BOF And Not rs.EOF
	    If strClientsList = "" Then
		    strClientsList = rs("cId")
		Else
		    strClientsList = strClientsList & "," & rs("uName")
		End If
		rs.MoveNext
	Loop
	rs.Close
	Set rs = Nothing
	getClientsList = strClientsList
End Function

Dim strCounter,strToPrint
strToPrint = strToPrint & "        <tr>" & VBCrlf
strToPrint = strToPrint & "          <td width=""100"" align=""center"" bgcolor=""menu"">拜访日期</td>" & VBCrlf
strToPrint = strToPrint & "          <td width=""80"" align=""center"" bgcolor=""menu"">拜访类型</td>" & VBCrlf
strToPrint = strToPrint & "          <td align=""center"" bgcolor=""menu"">客户名称</td>" & VBCrlf
strToPrint = strToPrint & "          <td width=""80"" align=""center"" bgcolor=""menu"">业务种类</td>" & VBCrlf
strToPrint = strToPrint & "          <td width=""80"" align=""center"" bgcolor=""menu"">行业类型</td>" & VBCrlf
strToPrint = strToPrint & "          <td width=""80"" align=""center"" bgcolor=""menu"">业务员</td>" & VBCrlf
strToPrint = strToPrint & "        </tr>" & VBCrlf

''''''''''''''''''''''''''''''''''''''
Function getClientsItem(cId,s)
    Dim rs,itemValue
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.Open "Select * From baidu_client Where cId = " & cId,conn,3,1
	If rs.RecordCount = 0 Then
	    itemValue = ""
	Else
	    itemValue = rs(s)
	End If
	rs.Close
	Set rs = Nothing
	getClientsItem = itemValue
End Function

Function listAll(mySql)
    Dim rs,strOut(2),strUserList
	Dim intTotalRecords,intTotalPages,intCurrentPage,intPageSize
	intCurrentPage = CInt(ABS(Request("pageNum")))
    If Not IsNumeric(intCurrentPage) Or intCurrentPage <= 0 Then intCurrentPage = 1
    intPageSize = 20

	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.Open mySql,conn,3,1
	intTotalRecords = rs.RecordCount
    rs.PageSize = intPageSize
    intTotalPages = rs.PageCount
    If intCurrentPage > intTotalPages Then intCurrentPage = intTotalPages
    If intTotalRecords > 0 Then rs.AbsolutePage = intCurrentPage
    strOut(0) = strOut(0) & "共 " & intTotalRecords & " 条记录 "
    strOut(0) = strOut(0) & "共 " & intTotalPages & " 页 "
    strOut(0) = strOut(0) & "当前第 " & intCurrentPage & " 页 "
    If intCurrentPage <> 1 And intTotalRecords <> 0 Then
        strOut(0) = strOut(0) & "<a href=""?pageNum=1""><<首页</a> "
    Else
        strOut(0) = strOut(0) & "<<首页 "
    End If
    If intCurrentPage > 1 Then
        strOut(0) = strOut(0) & "<a href=""?pageNum=" & intCurrentPage - 1 & """><上一页</a> "
    Else
        strOut(0) = strOut(0) & "<上一页 "
    End If
    If intCurrentPage < intTotalPages Then
        strOut(0) = strOut(0) & "<a href=""?pageNum=" & intCurrentPage + 1 & """>下一页></a> "
    Else
        strOut(0) = strOut(0) & "下一页> "
    End If
    If intCurrentPage <> intTotalPages Then
        strOut(0) = strOut(0) & "<a href=""?pageNum=" & intTotalPages & """>尾页>></a>"
    Else
        strOut(0) = strOut(0) & "尾页>>"
    End If
	
	Dim k
	k = 0
	Do While Not rs.BOF And Not rs.EOF
	    k = k + 1
	    strOut(1) = strOut(1) & "        <tr>" & VBCrlf
	    strOut(1) = strOut(1) & "        <td align=""center"">" & rs("rDate") & "</td>" & VBCrlf
	    strOut(1) = strOut(1) & "        <td>" & rs("rType") & "</td>" & VBCrlf
	    strOut(1) = strOut(1) & "        <td><a href=""view.asp?cId=" & rs("cId") & """>" & getClientsItem(rs("cId"),"cCompany") & "</a></td>" &  VBCrlf
	    strOut(1) = strOut(1) & "        <td>" & getClientsItem(rs("cId"),"cType") & "</td>" & VBCrlf
		strOut(1) = strOut(1) & "        <td>" & getClientsItem(rs("cId"),"cTrade") & "</td>" & VBCrlf
		'If Session("CRM_level") = 9 Then
	        strOut(1) = strOut(1) & "        <td>" & getClientsItem(rs("cId"),"cUser") & "</td>" & VBCrlf
		'End If
	    strOut(1) = strOut(1) & "        </tr>" & VBCrlf
		If k >= intPageSize Then Exit Do
		rs.MoveNext
	Loop
	rs.Close
	Set rs = Nothing
	listAll = strOut
End Function

Function listAllAtDate(mySql,intDay)
    Dim rs,strOut(2),strUserList
	Dim intTotalRecords,intTotalPages,intCurrentPage,intPageSize
	intCurrentPage = CInt(ABS(Request("pageNum")))
    If Not IsNumeric(intCurrentPage) Or intCurrentPage <= 0 Then intCurrentPage = 1
    intPageSize = 20

	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.Open mySql,conn,3,1
	intTotalRecords = rs.RecordCount
    rs.PageSize = intPageSize
    intTotalPages = rs.PageCount
    If intCurrentPage > intTotalPages Then intCurrentPage = intTotalPages
    If intTotalRecords > 0 Then rs.AbsolutePage = intCurrentPage
	strOut(0) = strOut(0) & "共 " & intTotalRecords & " 条记录 "
	If intDay <> "" Then
	    strOut(0) = strOut(0) & "共" & intDay & " 天 "
	    strOut(0) = strOut(0) & "平均 " & FormatNumber((intTotalRecords / intDay),1,-1) & " 条记录/ 天 "
	End If
    strOut(0) = strOut(0) & "共 " & intTotalPages & " 页 "
    strOut(0) = strOut(0) & "当前第 " & intCurrentPage & " 页 "
    If intCurrentPage <> 1 And intTotalRecords <> 0 Then
        strOut(0) = strOut(0) & "<a href=""?pageNum=1""><<首页</a> "
    Else
        strOut(0) = strOut(0) & "<<首页 "
    End If
    If intCurrentPage > 1 Then
        strOut(0) = strOut(0) & "<a href=""?pageNum=" & intCurrentPage - 1 & """><上一页</a> "
    Else
        strOut(0) = strOut(0) & "<上一页 "
    End If
    If intCurrentPage < intTotalPages Then
        strOut(0) = strOut(0) & "<a href=""?pageNum=" & intCurrentPage + 1 & """>下一页></a> "
    Else
        strOut(0) = strOut(0) & "下一页> "
    End If
    If intCurrentPage <> intTotalPages Then
        strOut(0) = strOut(0) & "<a href=""?pageNum=" & intTotalPages & """>尾页>></a>"
    Else
        strOut(0) = strOut(0) & "尾页>>"
    End If
	
	Dim k
	k = 0
	Do While Not rs.BOF And Not rs.EOF
	    k = k + 1
	    strOut(1) = strOut(1) & "        <tr>" & VBCrlf
	    strOut(1) = strOut(1) & "        <td align=""center"">" & rs("rDate") & "</td>" & VBCrlf
	    strOut(1) = strOut(1) & "        <td>" & rs("rType") & "</td>" & VBCrlf
	    strOut(1) = strOut(1) & "        <td><a href=""view.asp?cId=" & rs("cId") & """>" & getClientsItem(rs("cId"),"cCompany") & "</a></td>" &  VBCrlf
	    strOut(1) = strOut(1) & "        <td>" & getClientsItem(rs("cId"),"cType") & "</td>" & VBCrlf
		strOut(1) = strOut(1) & "        <td>" & getClientsItem(rs("cId"),"cTrade") & "</td>" & VBCrlf
		'If Session("CRM_level") = 9 Then
	        strOut(1) = strOut(1) & "        <td>" & getClientsItem(rs("cId"),"cUser") & "</td>" & VBCrlf
		'End If
	    strOut(1) = strOut(1) & "        </tr>" & VBCrlf
		If k >= intPageSize Then Exit Do
		rs.MoveNext
	Loop

⌨️ 快捷键说明

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