<%
Act = Request.QueryString("act")
If act = "save" Then
Set Rs = Server.CreateObject("ADODB.RecordSet")
isedit = False
id = Request.Form("id")
If id<>"" And IsNumeric(id) Then isedit = True
cs_code=TextEnCode(Request.Form("cs_code"))
cs_company=TextEnCode(Request.Form("cs_company"))
cs_name=TextEnCode(Request.Form("cs_name"))
cs_belong=Request.Form("cs_belong")
cs_country=Request.Form("cs_country")
cs_from=Request.Form("cs_from")
cs_tel=TextEnCode(Request.Form("cs_tel"))
cs_email=TextEnCode(Request.Form("cs_email"))
cs_whatsapp=TextEnCode(Request.Form("cs_whatsapp"))
cs_wechat=TextEnCode(Request.Form("cs_wechat"))
cs_linkedin=TextEnCode(Request.Form("cs_linkedin"))
cs_facebook=TextEnCode(Request.Form("cs_facebook"))
cs_alibaba=TextEnCode(Request.Form("cs_alibaba"))
cs_state=Request.Form("cs_state")
cs_deal=Request.Form("cs_deal")
no_content=HtmlEnCode(Request.Form("no_content"))
allowedit=Request.Form("allowedit")
IF allowedit<>1 Then allowedit=0
If isedit Then
Rs.Open "Select * From customer Where id="&id,Conn,1,3
If Not Rs.bof and Not Rs.eof Then
Rs("cs_code") = cs_code
Rs("cs_company") = cs_company
Rs("cs_name")=cs_name
Rs("cs_belong") = cs_belong
Rs("cs_country")=cs_country
Rs("cs_from") = cs_from
Rs("cs_tel")=cs_tel
Rs("cs_email")=cs_email
Rs("cs_whatsapp")=cs_whatsapp
Rs("cs_wechat")=cs_wechat
Rs("cs_linkedin")=cs_linkedin
Rs("cs_facebook")=cs_facebook
Rs("cs_alibaba")=cs_alibaba
Rs("cs_state") = cs_state
Rs("cs_deal")=cs_deal
Rs("cs_note")=no_content
Rs("allowedit")=allowedit
myArray=split(Rs("cs_chain"),",")
myLen=UBound(myArray)
Litem=myArray(myLen)
IF Litem+0<>cs_belong+0 Then
Rs("cs_chain")=Rs("cs_chain")&","&cs_belong
End If
Rs.Update:Rs.Close
Page = Request.QueryString("Page")
Keys=Server.UrlEnCode(Request.QueryString("Keys"))
Response.Redirect "?keys="&Keys&"&Page="&Page&urlStr
Set Rs=Nothing:Conn.Close:Set Conn=Nothing
Else
Response.write ""
Rs.close
Set Rs=Nothing
Conn.close
Set Conn=Nothing
Response.End
End If
End If
Conn.Close:Set Conn=Nothing
Response.End
End If 'end save
If Act = "edit" Then
id = Request.QueryString("id")
isedit = False
If id<>"" And IsNumeric(id) Then isedit=True
If isedit Then
Set Rs = Server.CreateObject("ADODB.RecordSet")
Rs.Open "Select * From customer Left Join myNote on customer.cs_code=myNote.c_code Where customer.id="&id,Conn,1,1
If Not Rs.Bof And Not Rs.Eof Then
cs_code=TextUnCode(Rs("cs_code"))
cs_company=TextUnCode(Rs("cs_company"))
cs_name=TextUnCode(Rs("cs_name"))
cs_country=Rs("cs_country")
cs_from=Rs("cs_from")
cs_tel=TextUnCode(Rs("cs_tel"))
cs_telBu=TextUnCode(Rs("cs_telBu"))
cs_Wechat=TextUnCode(Rs("cs_Wechat"))
cs_WechatBu=TextUnCode(Rs("cs_WechatBu"))
cs_Whatsapp=TextUnCode(Rs("cs_Whatsapp"))
cs_WhatsappBu=TextUnCode(Rs("cs_WhatsappBu"))
cs_email=TextUnCode(Rs("cs_email"))
cs_emailBu=TextUnCode(Rs("cs_emailBu"))
cs_linkedin=TextUnCode(Rs("cs_linkedin"))
cs_linkedinBu=TextUnCode(Rs("cs_linkedinBu"))
cs_facebook=TextUnCode(Rs("cs_facebook"))
cs_facebookBu=TextUnCode(Rs("cs_facebookBu"))
cs_alibaba=TextUnCode(Rs("cs_alibaba"))
cs_alibabaBu=TextUnCode(Rs("cs_alibabaBu"))
cs_address=TextUnCode(Rs("cs_address"))
cs_addtime=Rs("cs_addtime")
cs_updatetime=Rs("cs_updatetime")
cs_belong=Rs("cs_belong")
cs_state=Rs("cs_state")
cs_deal=Rs("cs_deal")
cs_note=HtmlUnCode(Rs("cs_note"))
allowedit=Rs("allowedit")
Else
isedit = False
End If
Rs.Close:Set Rs=Nothing
End If
Page = Request.QueryString("Page")
Keys=Server.UrlEnCode(Request.QueryString("Keys"))
Ord=Server.UrlEnCode(Request.QueryString("Ord"))
hrefstr = "?keys="&Keys&"&Page="&Page&"&Ord="&Ord
%>
<%
Response.End
End If 'End Edit
If Act="postchk" Then
Keys = Server.UrlEnCode(Request.QueryString("Keys"))
Page = Request.QueryString("Page")
chkact = Request.Form("chkact")
SqlStr = ""
For i = 1 To Request.Form("chkbox").Count
If SqlStr<>"" Then
SqlStr = SqlStr & " Or id="&Request.Form("chkbox")(i)
Else
SqlStr = " Where id="&Request.Form("chkbox")(i)
End If
Next
Select Case chkact
Case "0":SqlStr = "Update customer Set cs_state="&chkact&SqlStr
Case "1":SqlStr = "Update customer Set cs_state="&chkact&SqlStr
Case Else:SqlStr = "Delete From customer"&SqlStr
End Select
Conn.Execute(SqlStr):Conn.Close:Set Conn=Nothing
Response.Redirect "?Keys="&Keys&"&Page="&Page
Response.End
End If 'End postchk
fliterQudao=Request.QueryString("fliterQudao")
fliterDeal=Request.QueryString("fliterDeal")
fliterTeam=Request.QueryString("fliterTeam")
fliterContact=Request.QueryString("fliterContact")
fliterEmployee=Request.QueryString("fliterEmployee")
fliterStr=""
If fliterQudao<>"" Then
fliterStr=fliterStr&" and cs_from="&Cint(fliterQudao)
urlStr=urlStr&"&fliterQudao="&fliterQudao
End If
If fliterDeal<>"" Then
fliterStr=fliterStr&" and cs_deal="&Cint(fliterDeal)
urlStr=urlStr&"&fliterDeal="&fliterDeal
End If
If fliterTeam<>"" Then
fliterStr=fliterStr&" and (cs_belong="&Cint(fliterTeam)&" or cs_belong in (select id from employee where em_role="&Cint(fliterTeam)&") )"
urlStr=urlStr&"&fliterTeam="&fliterTeam
End If
If fliterEmployee<>"" Then
fliterStr=fliterStr&" and cs_belong="&Cint(fliterEmployee)
urlStr=urlStr&"&fliterEmployee="&fliterEmployee
End If
If fliterContact<>"" Then
Select Case fliterContact
Case "1":fliterStr=fliterStr&" and cs_tel<>''"
Case "2":fliterStr=fliterStr&" and cs_wechat<>''"
Case "3":fliterStr=fliterStr&" and cs_whatsapp<>''"
Case "4":fliterStr=fliterStr&" and cs_email<>''"
Case "5":fliterStr=fliterStr&" and cs_linkedin<>''"
Case "6":fliterStr=fliterStr&" and cs_facebook<>''"
Case Else:fliterStr=fliterStr&" and cs_alibaba<>''"
End Select
urlStr=urlStr&"&fliterContact="&fliterContact
End If
Keys=Request.QueryString("Keys")
Keyscode=TextEnCode(Keys)
Page = Request.QueryString("Page")
Ord=Request.QueryString("Ord")
Keys=Server.UrlEnCode(Request.QueryString("Keys"))
If Ord<>"" Then
OrdStr=Ord&","
Else
OrdStr=""
End If
sqlStr="Select id,cs_code,cs_name,cs_country,cs_address,cs_tel,cs_email,cs_whatsapp,cs_wechat,cs_linkedin,cs_facebook,cs_addtime,cs_alibaba,cs_from,cs_deal,cs_updatetime,cs_belong,cs_note,cs_claimFrom,cs_chain,cs_dealdate From customer Where ( cs_code like '%"&Keyscode&"%' or cs_name like '%"&Keyscode&"%' or cs_Wechat like '%"&Keyscode&"%' or cs_alibaba like '%"&Keyscode&"%' or cs_telformat like '%"&Keyscode&"%' or cs_Whatsappformat like '%"&Keyscode&"%' or cs_email like '%"&Keyscode&"%' ) "&fliterStr&" Order By "&OrdStr&" cs_updatetime Desc"
Set Rs=Server.CreateObject("ADODB.RecordSet")
hrefstr = "?keys="&Keys&urlStr
Set Rs1=Server.CreateObject("ADODB.RecordSet")
%>
<%
Rs.Open sqlStr,Conn,1,1
If Not Rs.Bof And Not Rs.Eof Then
Rs.PageSize = 18
If Page = "" Then Page = 1
If Page = "end" Then Page = Rs.PageCount
If Not IsNumeric(Page) Or Page < 1 Then Page = 1
Page = Cint(Page)
If Page > Rs.PageCount Then Page = Rs.PageCount
Rs.AbsolutePage = Page
TempNum = Rs.PageSize * (Page - 1)
Set Rs1=Server.CreateObject("ADODB.RecordSet")
For i=1 To Rs.PageSize
If Rs.Bof Or Rs.Eof Then Exit For
TempNum=TempNum+1:classid=Rs(1)
%>
<%
Rs1.Open "Select id,countryName from country where id="&Rs("cs_country")&"",conn,1,1
If Not Rs1.bof and Not Rs1.eof Then
Response.write Rs1("countryName")
Else
Response.write "未选择"
End If
Rs1.close
%>
<%
Rs1.Open "Select ch_name from qudao where id="&Rs("cs_from"),conn,1,1
If not Rs1.bof and not Rs1.eof Then
response.write Rs1("ch_name")
Else
response.write "未选择"
End If
Rs1.close
%>
<% If Rs("cs_deal")=3 Then
response.write ""&Rs("cs_dealdate")&"成交"
elseif Rs("cs_deal")=2 Then
Response.write "明确需求"
elseif Rs("cs_deal")=1 Then
Response.write "背景调查"
else
Response.write "无响应"
End If%>
<%
Rs1.Open "Select em_user from employee where id="&Rs("cs_belong"),conn,1,1
If not Rs1.bof and not Rs1.eof Then
response.write Rs1("em_user")
Else
response.write "未选择"
End If
Rs1.close
%>
流转记录:
<% myArray=split(Rs("cs_chain"),",")
sqlStr="Select em_user from employee where id="&myArray(0)
for j=1 to UBound(myArray)
sqlStr=sqlStr&" union all Select em_user from employee where id="&myArray(j)
next
Rs1.open sqlStr,conn,1,1
Do while Not Rs1.bof and Not Rs1.eof
Response.write Rs1("em_user")&" > "
Rs1.moveNext
loop
Rs1.close
%>
<%
If Rs.PageCount > 1 Then
PageName="?Keys="&Keys&"&Ord="&Ord&urlStr&"&"
Pagelen=3
If Page>1 Then
Response.Write "首页"
Response.Write "上一页"
End If
If Pagelen*2+1 >= Rs.PageCount Then
StartPage=1:EndPage=Rs.PageCount
Else
If Page<=Pagelen+1 Then
StartPage=1
EndPage=Pagelen*2+1
Else
StartPage=Page-Pagelen
EndPage=Page+Pagelen
End If
If Page+Pagelen>Rs.PageCount Then StartPage=Rs.PageCount-Pagelen*2:EndPage=Rs.PageCount
End If
For i = StartPage To EndPage
If i = Page Then
Response.Write ""&i&""
Else
Response.Write ""&i&""
End If
Next
If Page Pagelen Then Response.Write "..."&Rs.PageCount&""
Response.Write "下一页"
Response.Write "尾页"
End If
Response.Write ""
End If
%>