<%Checklogin()%> <% datestart=Request.Form("start") dateend=Request.Form("end") currentMonth=year(date)&"-"&month(date)&"-1 00:00:00" if datestart="" or Not IsDate(datestart) Then datestart=currentMonth else datestart=FormatTime(datestart,"yyyy-mm-dd")&" 00:00:00" End if if dateend="" or Not IsDate(dateend) Then dateend=now() else dateend=FormatTime(dateend,"yyyy-mm-dd")&" 23:59:59" End if %> 管理区域

各组数据

日期筛选
<% Set Rs=Server.CreateObject("ADODB.RecordSet") Rs.Open "select id,em_user from employee where em_role=0 and id<>13",conn,1,1 Do while Not Rs.bof and Not Rs.eof clstr="" Set Rs1=Server.CreateObject("ADODB.RecordSet") Rs1.Open "Select count(DISTINCT cs_code) as c1 from customer where cs_belong="&Rs("id"),conn,1,1 c1=Rs1("c1")'总客户数量 Rs1.close Rs1.Open "Select count(id) as c2 from customer where cs_deal<>3 and cs_deal<>0 and cs_type<>2 and DATEDIFF(day,cs_updatetime,getDate())>90 and cs_belongclient=0 and cs_belong="&Rs("id"),conn,1,1 c2=Rs1("c2")'进入公海 Rs1.close Rs1.Open "Select DISTINCT cs_code from customer where cs_dealdate>'"&datestart&"' and cs_dealdate<='"&dateend&"' and cs_deal=3 and cs_belong="&Rs("id"),conn,1,1 c3=Rs1.RecordCount'成交 Do while Not Rs1.bof and Not Rs1.eof clstr=clstr&Rs1("cs_code")&"
" Rs1.moveNext loop Rs1.close Rs1.Open "Select count(DISTINCT cs_code) as c4 from customer where cs_claimdate>'"&datestart&"' and cs_claimdate<='"&dateend&"' and cs_belong="&Rs("id"),conn,1,1 c4=Rs1("c4")'认领 Rs1.close Rs1.Open "Select count(id) as c5 from employee where em_role="&Rs("id"),conn,1,1 c5=Rs1("c5") Rs1.close Set Rs1=Nothing %> <% Set Rs1=Server.CreateObject("ADODB.RecordSet") Rs1.Open "Select id,em_user from employee Where em_role="&Rs("id"),conn,1,1 Do while Not Rs1.bof and Not Rs1.eof clstr="" Set Rs2=Server.CreateObject("ADODB.RecordSet") Rs2.Open "Select count(DISTINCT cs_code) as c1 from customer where cs_belong="&Rs1("id"),conn,1,1 c1=Rs2("c1")'总客户数量 Rs2.close Rs2.Open "Select count(DISTINCT cs_code) as c2 from customer where cs_deal<>3 and cs_deal<>0 and cs_type<>2 and DATEDIFF(day,cs_updatetime,getDate())>90 and cs_belongclient=0 and cs_belong="&Rs1("id"),conn,1,1 c2=Rs2("c2")'进入公海 Rs2.close Rs2.Open "Select DISTINCT cs_code from customer where cs_dealdate>'"&datestart&"' and cs_dealdate<='"&dateend&"' and cs_deal=3 and cs_belong="&Rs1("id"),conn,1,1 c3=Rs2.RecordCount'成交 Do while Not Rs2.bof and Not Rs2.eof clstr=clstr&Rs2("cs_code")&"
" Rs2.moveNext loop Rs2.close Rs2.Open "Select count(id) as c4 from customer where cs_claimdate>'"&datestart&"' and cs_claimdate<='"&dateend&"' and cs_belong="&Rs1("id"),conn,1,1 c4=Rs2("c4")'认领 Rs2.close Set Rs2=Nothing Response.write "" Rs1.moveNext loop Rs1.close Set Rs1=Nothing Rs.moveNext loop Rs.close %>
组长 组员 总客户数量 本月成交 进公海客户总数 公海认领
<%=Rs("em_user")%> <%=Rs("em_user")%> <%=c1%> <%=clstr%> <%=c2%> <%=c4%>
"&Rs1("em_user")&""&c1&""&clstr&""&c2&""&c4&"
<%Set Rs=Nothing:Conn.Close:Set Conn=Nothing%>