📄 search.asp
字号:
<!-- #include file = "../include/asphead.asp" -->
<!-- #include file = "../include/function.asp" -->
<!-- #include file = "../include/calendar.asp" -->
<%CheckUser()%>
<link href="../include/main.css" rel="stylesheet" type="text/css">
<script src="../include/function.js" type="text/javascript"></script>
<script ID="clientEventHandlersJS" LANGUAGE="javascript">
<!--
function HideSearch()
{
parent.window.Content.cols="0,0,*"
parent.RightHead.document.all['divShowSearch'].style.visibility = 'visible'
}
function Report_onchange()
{
DisableButton();
frmData.SearchID.selectedIndex=0;
frmData.CurItems.value="";
frmData.MultiSelectItems.value="";
frmData.KeepCurItem.value="0";
frmData.target ="";
frmData.action ="";
frmData.submit();
}
function Search_onchange()
{
DisableButton();
frmData.target ="";
frmData.action ="";
frmData.CurItems.value="";
frmData.MultiSelectItems.value="";
frmData.KeepCurItem.value="0";
frmData.submit();
}
function Search()
{
if(GeneralDC() && LocalDC())
{
frmData.ClientWidth.value =window.screen.width;
frmData.ClientHeight.value =window.screen.height ;
frmData.target ="RightData";
frmData.action ="report.asp";
frmData.submit();
}
}
function LocalDC()
{
if(CheckFromTo() && CheckMultiSelect())
return true;
else
return false;
}
//判断数值型、日期型字段输入的From、To的合法性,即:From<=to
function CheckFromTo()
{
var ID;
var FieldDataFrom,FieldDataTo;
if (FieldCount>0)
{
for (var i=1 ; i<=FieldID.length; i++)
{
if(typeof(frmData.all[FieldID[i-1]])!="undefined")
{
if(FieldType[i-1]==DataType_Number || FieldType[i-1]==DataType_Date || FieldType[i-1]==DataType_DateAndTime)
{
if(FieldID[i-1].substr(0,2)=='To')
ID=FieldID[i-1].substr(2)
else
ID=FieldID[i-1].substr(4)
FieldDataFrom=JTrim(frmData.all["From" + ID].value);
FieldDataTo=JTrim(frmData.all["To" + ID].value);
if(DataCheck(FieldCaption[i-1].substr(0,FieldCaption[i-1].length-3),parseInt(FieldType[i-1]),FieldDataFrom,"",FieldDataTo)==false)
return(false);
}
}
}
return(true);
}
else
{
return(true);
}
}
//选择型字段是多选的情况下,需检查多选的个数,最多不得超过30个
function CheckMultiSelect()
{
var MaxCount=30;
var ListCount,SelectedCount;
var FieldData;
if (FieldCount>0)
{
for (var i=1 ; i<=FieldID.length; i++)
{
if(typeof(frmData.all[FieldID[i-1]])!="undefined")
{
if(FieldType[i-1]==DataType_Option || FieldType[i-1]==DataType_Checkbox)
{
ListCount=frmData.all[FieldID[i-1]].length;
if(ListCount>0)
{
SelectedCount=0;
for (var j=1 ; j<=ListCount; j++)
{
if(frmData.all[FieldID[i-1]].options[j-1].selected==true)
{
SelectedCount=SelectedCount+1;
}
}
if(SelectedCount>MaxCount)
{
alert(FieldCaption[i-1]+"选择的列表项太多,最多选"+MaxCount+"项,请适当减少。");
return(false);
}
}
}
}
}
return(true);
}
else
{
return(true);
}
}
function MoreField()
{
var ret,CurItems,MultiSelectItems;
CurItems=frmData.CurItems.value;
MultiSelectItems=frmData.MultiSelectItems.value;
ret=window.showModalDialog ("setsearchframe.asp?CurItems="+CurItems+"&MultiSelectItems="+MultiSelectItems ,"Setting","dialogleft:50px;dialogwidth:450px;dialogheight:445px;Status:0;center:1;resizable=1;");
if(typeof(ret)!="undefined")
if(ret.charAt(0)=="1")
{
DisableButton();
var parts
ret=ret.substr(2,ret.length-2);
parts=ret.split("|");
frmData.CurItems.value=parts[0];
frmData.MultiSelectItems.value=parts[1];
frmData.KeepCurItem.value="1";
frmData.target ="";
frmData.action ="";
frmData.submit();
}
}
function SearchSave()
{
if(JTrim(frmData.AccountType.value)==2)
alert("您是公共账号用户,没有保存查询器的权限。")
else
{
if(JTrim(frmData.SearchCaption.value)=="")
alert("查询器名称未填,请填写。")
else
{
if(CheckSearchExist())
alert("查询器重名。本统计报表中已有相同名称的查询器,请更改后再保存。")
else
{
if(CheckMultiSelect())
{
DisableButton();
frmData.target ="";
frmData.action ="";
frmData.Action.value ="Save";
frmData.submit();
}
}
}
}
}
function CheckSearchExist()
{
var CurIndex,CurCaption,Caption;
CurIndex=frmData.SearchID.selectedIndex;
CurCaption=frmData.SearchCaption.value;
CurCaption=JTrim(CurCaption);
for(var i=0;i<=frmData.SearchID.length-1;i++)
{
if(i!=CurIndex)
{
Caption=frmData.SearchID[i].text;
Caption=JTrim(Caption);
if(CurCaption==Caption)
return(true);
}
}
return(false);
}
function SearchDel()
{
if(JTrim(frmData.AccountType.value)==2)
alert("您是公共账号用户,没有删除查询器的权限。")
else
{
var CurCaption;
CurCaption=frmData.SearchID[frmData.SearchID.selectedIndex].text;
if(confirm("您确定要删除查询器" + CurCaption + "吗?")==true)
{
DisableButton();
frmData.target ="";
frmData.action ="";
frmData.Action.value ="Del";
frmData.submit();
}
}
}
function window_onload()
{
var CurCaption;
CurCaption=frmData.SearchID[frmData.SearchID.selectedIndex].text;
CurCaption=JTrim(CurCaption);
frmData.SearchCaption.value =CurCaption;
if(frmData.SearchID.selectedIndex==0)
{
frmData.btnDel.disabled =true;
}
else
{
frmData.btnDel.disabled =false;
}
if(frmData.ReportID.selectedIndex==0)
{
frmData.btnSearch.disabled =true;
frmData.btnMoreField.disabled =true;
frmData.btnSave.disabled =true;
}
else
{
frmData.btnSearch.disabled =false;
frmData.btnMoreField.disabled =false;
frmData.btnSave.disabled =false;
}
}
function DisableButton()
{
frmData.btnDel.disabled =true;
frmData.btnMoreField.disabled =true;
frmData.btnSearch.disabled =true;
frmData.btnSave.disabled =true;
}
//-->
</script>
<%
dim WExcel
set WExcel=server.CreateObject("WExcel.Report")
dim SheetID
dim KeepCurItem,CurItems,OldItems,MultiSelectItems
dim BodyStr,GCScript,SelectedID,ReportList
dim AccountType
SheetID=Request.Cookies("Report")("SheetID")
KeepCurItem=Request.Form("KeepCurItem")
CurItems=Request.Form("CurItems")
OldItems=Request.Form("OldItems")
MultiSelectItems=Request.Form("MultiSelectItems")
AccountType=Request.Cookies("Login")("AccountType")
dim ChangeReportOrSearch,ReportID,SearchID
if instr(1,Request.ServerVariables("HTTP_REFERER"),"search.asp")>0 then
ChangeReportOrSearch=true
ReportID=Request.Form("ReportID")
SearchID=Request.Form("SearchID")
else
ChangeReportOrSearch=false
ReportID=Request.Cookies("Report")("ReportID" & SheetID)
SearchID=Request.Cookies("Report")("SearchID" & SheetID & "-" & ReportID)
end if
if ReportID="" then
ReportID=0
end if
if SearchID="" then
SearchID=0
end if
Response.Cookies("Report")("ReportID" & SheetID)=ReportID
Response.Cookies("Report")("SearchID" & SheetID & "-" & ReportID)=SearchID
Response.Cookies("Report").Expires = CookieLife
if ReportID>0 then
if Request.Form("Action")="Save" then
dim NewID
WExcel.SaveSearch cint(UserID),cint(SheetID),cint(ReportID),cint(SearchID),NewID
SearchID=NewID
Response.Cookies("Report")("SearchID" & SheetID & "-" & ReportID)=SearchID
Response.Cookies("Report").Expires = CookieLife
elseif Request.Form("Action")="Del" then
WExcel.DelSearch cint(UserID),cint(SheetID),cint(ReportID),cint(SearchID)
SearchID=0
Response.Cookies("Report")("SearchID" & SheetID & "-" & ReportID)=SearchID
Response.Cookies("Report").Expires = CookieLife
end if
end if
WExcel.GetReportOption cint(UserID),cint(SheetID),cint(ReportID),SelectedID,ReportList
if SelectedID>0 then
if ChangeReportOrSearch then
'如果是切换查询器、保存删除查询器、定义更多条件,则按查询器显示
WExcel.GetSearchPage cint(UserID),cint(SheetID),cint(ReportID),cint(SearchID),cstr(KeepCurItem),CurItems,MultiSelectItems,OldItems,BodyStr,GCScript
else
'否则,如果曾经作过查询就按照原查询条件恢复查询页面
dim Searched,SearchValues
Searched=Request.Cookies("Report")("Searched" & CoID & "-" & SheetID & "-" & ReportID)
if Searched="1" then
SearchValues=Request.Cookies("ReportSearchValues")(CoID & "-" & SheetID & "-" & ReportID)
'在V3.82之前,此Cookie的名称是Cookies("Report")("SearchValues" & CoID & "-" & SheetID)
'为了保持老用户的兼容性,如果新Cookie未取出值来,则尝试取旧值
if SearchValues="" then
SearchValues=Request.Cookies("Report")("SearchValues" & CoID & "-" & SheetID & "-" & ReportID)
end if
dim WExcel2
set WExcel2=server.CreateObject("WExcel.Sheet")
WExcel2.GetSearchPageBySearchValue cint(UserID),cint(SheetID),cstr(SearchValues),CurItems,MultiSelectItems,OldItems,BodyStr,GCScript
else
SearchID=0
WExcel.GetSearchPage cint(UserID),cint(SheetID),cint(ReportID),cint(SearchID),cstr(KeepCurItem),CurItems,MultiSelectItems,OldItems,BodyStr,GCScript
end if
end if
Response.Write GCScript
end if
SearchList=WExcel.GetSearchList(cint(UserID),cint(SheetID),cint(ReportID),cint(SearchID))
CheckErr
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" LANGUAGE="javascript" onload="return window_onload()">
<form METHOD="post" name="frmData">
<table width="100%" border="0" cellPadding="0" cellSpacing="1">
<tr height="25">
<td colspan="2">
<table width="100%" border="0" cellPadding="0" cellSpacing="0">
<tr>
<td width="35%">
<p align="left">
<img src="../images/hide.gif" alt="隐藏查询条件" style="cursor:hand" onClick="HideSearch()" width="26" height="20" border="0">
</p>
</td>
<td width="65%">
<p align="left">
<b>报表查询</b>
</p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<p align="left">
<select name="ReportID" style="width:197px;" LANGUAGE="javascript" onchange="return Report_onchange()">
<%=ReportList%>
</select>
</p>
</td>
</tr>
<tr>
<td bgcolor="#e0e0e0" width="23%">
<p align="left">查询器</p>
</td>
<td width="77%">
<p align="right">
<select name="SearchID" style="width:113px;" LANGUAGE="javascript" onchange="return Search_onchange()">
<%=SearchList%>
</select>
</p>
</td>
</tr>
<tr>
<td colspan="2">
<hr>
</td>
</tr>
<%=BodyStr%>
<tr>
<td width="55%"></td>
<td width="45%"></td>
</tr>
<tr height="30" valign="bottom">
<td colspan="2">
<input type="button" name="btnMoreField" disabled value="更多条件" style="cursor:hand; WIDTH: 80px; HEIGHT: 24px" LANGUAGE="javascript" onclick="return MoreField()">
<input type="button" name="btnSearch" disabled value="查询" style="cursor:hand; WIDTH: 80px; HEIGHT: 24px" LANGUAGE="javascript" onclick="return Search()">
</td>
</tr>
<tr>
<td colspan="2">
<hr>
</td>
</tr>
<tr>
<td bgcolor="#e0e0e0">
<p align="left">查询器名称</p>
</td>
<td>
<p align="left"><input TYPE="input" NAME="SearchCaption" style="width:113px;" maxLength=20 LANGUAGE="javascript" onchange="return HasChange()"></p>
</td>
</tr>
<tr height="30" valign="bottom">
<td colspan="2">
<input type="button" name="btnSave" disabled value="保存查询器" style="cursor:hand; WIDTH: 80px; HEIGHT: 24px" LANGUAGE="javascript" onclick="return SearchSave()">
<input type="button" name="btnDel" disabled value="删除查询器" style="cursor:hand; WIDTH: 80px; HEIGHT: 24px" LANGUAGE="javascript" onclick="return SearchDel()">
</td>
</tr>
<iframe id="SaveArea" name="SaveArea" style="visibility:hidden" width="0" height="0" frameborder="0" src>
</iframe>
</table>
<input TYPE="hidden" NAME="Action" value="0">
<input TYPE="hidden" NAME="CurItems" value="<%=CurItems%>">
<input TYPE="hidden" NAME="OldItems" value="<%=OldItems%>">
<input TYPE="hidden" NAME="MultiSelectItems" value="<%=MultiSelectItems%>">
<input TYPE="hidden" NAME="KeepCurItem">
<input TYPE="hidden" NAME="ClientWidth">
<input TYPE="hidden" NAME="ClientHeight">
<input TYPE="hidden" NAME="AccountType" value="<%=AccountType%>">
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -