<%
if request("Submit")<>"" then'1
'取开始时间
if trim(request("cx2"))<>"" then
strdate=trim(request("cx2"))&" 00:00:00"
strdate2=trim(request("cx2"))&" 23:59:59"
end if
'取结束时间
if trim(request("cx3"))<>"" then
enddate=trim(request("cx3"))&" 23:59:59"
end if
'取分局信息
if trim(request("select1"))<>"all" then
fjid=" and a.fjid='"&trim(request.form("select1"))&"'"
else fjid=""
end if
'给定时间范围查询
if request.form("cx2")<>"" and request.form("cx3")<>"" then
tj="cj_rq>='"&strdate&"' and cj_rq<='"&enddate&"' "&fjid&" "
end if
'给定一天查询
if request.form("cx2")<>"" and request.form("cx3")="" then
tj="cj_rq>='"&strdate&"' and cj_rq<='"&strdate2&"' "&fjid&" "
end if
'开始查询
if request.form("cx2")="" or request.form("cx3")="" or trim(request("select1"))="" then
response.write "<script> alert('请输入查询条件!');history.back(1);</script>"
'xx=1
else
' xx=2
sql1=" select a.acc_nbr ,a.serv_name ,a.address ,b.fjmc ,a.lxdh ,convert(varchar,a.cj_rq,2) as cj_rq,a.tk ,d.cj_type_name,a.id from kd_delete a,fjb b ,s_cj_type d where a.fjid=b.id and b.flag_id='1' and a.cj_type_id=d.cj_type_id and "&tj&" order by b.fjmc,cj_rq desc"
session("sql")=sql1
sql2=" select str(count(*)) as c_count from kd_delete a,fjb b ,s_cj_type d where a.fjid=b.id and b.flag_id='1' and a.cj_type_id=d.cj_type_id and "&tj&""
set rs1=server.createobject("ADODB.Recordset")
rs1.open sql1,conn
set rs2=server.createobject("ADODB.Recordset")
rs2.open sql2,conn
c_count=rs2("c_count")
'set rs2=server.CreateObject("adodb.command")
'set rs2.activeconnection=conn
'rs2.commandtext=sql2
'rs2.execute
if rs1.eof and rs1.bof then
response.write "<script> alert('没有你要查汇总信息');history.back(1);</script>"
'else response.write tj
end if
end if
end if
%>