<%Checklogin()%> <% cid=Request.QueryString("cid") If cid="" or not isNumeric(cid) Then cid=0 End If sqlstr="select count(id) as claimcount from customer where cs_belong="&Session("employee_id")&" and cs_claimdate>'"&date()&"'" Set Rs=Server.CreateObject("ADODB.Recordset") Rs.open sqlstr,conn,1,1 If Rs("claimcount")>10 Then Reachedlimit=True Else Reachedlimit=False End If Rs.close Rs.open "select em_code from employee where id="&Session("employee_id"),conn,1,1 em_code=Rs("em_code") Rs.close If Reachedlimit=True Then Response.write "-1" Else Rs.open "select employee.id as originalId,cs_code,em_user,cs_belong,cs_updatetime,cs_claimdate,cs_claimFrom,cs_chain,is_silent from customer left join employee on customer.cs_belong=employee.id where customer.id="&cid,conn,1,3 If Not Rs.bof and Not Rs.eof Then Rs("cs_belong")=Session("employee_id") Rs("cs_claimdate")=now() oldCode=Rs("cs_code") Rs("cs_code")=Replace(Rs("cs_code"),"-","/0"&mid(em_code,2)&"-") Rs("cs_updatetime")=now() originalEmp=Rs("em_user") Rs("cs_claimFrom")=Rs("originalId") Rs("cs_chain")=Rs("cs_chain")&","&Session("employee_id") '更新流转记录 Circulation=len(Rs("cs_chain"))-len(replace(Rs("cs_chain"),",","")) if Circulation>3 Then Rs("is_silent")=1 Else Rs("is_silent")=0 End If '是否作为沉默客户 End If Rs.update Rs.close conn.execute("Insert into claimRecord (oldCode,originalEmp,newEmp,cs_id,claimTime,isread) values('"&oldCode&"','"&originalEmp&"','"&Session("employee_name")&"',"&cid&",'"&now()&"',0)") conn.execute("Delete from tagTable where customerId="&cid&"") Response.write "1" End If Set Rs=Nothing conn.close Set conn=Nothing %>