?? dataform.asp
字號:
<%@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" -->
<%
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("default.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) & " 條記錄/ 天 "
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -