📄 popsetavgformula.asp
字号:
<!-- #include file = "../../../include/asphead.asp" -->
<!-- #include file = "../../../include/function.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">
<!--
var HasChanged;
function Init()
{
SetAvgStyle();
}
function SetAvgStyle()
{
//如果是按记录数求平均,则disable除法选项
if(frmData.AvgStyle[0].status==true)
{
frmData.DividendFieldID.disabled=true;
frmData.DivisorFieldID.disabled=true;
}
else
{
frmData.DividendFieldID.disabled=false;
frmData.DivisorFieldID.disabled=false;
}
}
function Save() {
if(CheckInput())
{
window.returnValue = "1," + GetFormula();
window.close();
}
}
function Cancel()
{
window.returnValue = "0";
if(HasChanged==true)
{
discard=confirm("您已经修改了某些信息,但尚未保存。放弃您所作的修改吗?");
if(discard==true)
{
window.close();
}
}
else
{
window.close();
}
}
//检查当前界面数据的有效性
function CheckInput()
{
//如果是按记录数求平均,则无需检查
if(frmData.AvgStyle[0].status==true)
{
return(true);
}
var DividendFieldID,DivisorFieldID;
DividendFieldID=frmData.DividendFieldID.value;
DivisorFieldID=frmData.DivisorFieldID.value;
if(DividendFieldID<=0)
{
alert("未选择被除数,请选择。");
return(false);
}
if(DivisorFieldID<=0)
{
alert("未选择除数,请选择。");
return(false);
}
if(DividendFieldID==DivisorFieldID)
{
alert("被除数与除数是相同的,请更正。");
return(false);
}
return(true);
}
function HasChange() {
// HasChanged=true; //pop式窗口,没必要提示保存
}
function GetFormula()
{
var strFormula,strFormulaDesc;
if(frmData.AvgStyle[0].status==true)
{
strFormula="";
strFormulaDesc="按记录数求平均";
}
else
{
//如果是自定义求平均的方式,则需要获取计算公式
var DividendField,DivisorField;
var curSelectedIndex;
DividendField=frmData.DividendFieldID.value;
DivisorField=frmData.DivisorFieldID.value;
strFormula=DividendField + "/" + DivisorField;
curSelectedIndex=frmData.DividendFieldID.selectedIndex;
DividendField=frmData.DividendFieldID[curSelectedIndex].text;
curSelectedIndex=frmData.DivisorFieldID.selectedIndex;
DivisorField=frmData.DivisorFieldID[curSelectedIndex].text;
strFormulaDesc=DividendField + "/" + DivisorField;
}
return(strFormula + "|" + strFormulaDesc);
}
//-->
</script>
<%
dim WExcel
set WExcel=server.CreateObject("WExcel.System")
dim SheetID,CurFormula
CurFormula=Request.QueryString("CurFormula")
dim Success,DividendOption,DivisorOption
SheetID=Request.Cookies("System")("StructureSheetID")
Success=WExcel.GetAvgFormulaPage(cint(UserID),cint(SheetID),cstr(CurFormula),DividendOption,DivisorOption)
dim StyleChk(2)
if CurFormula<>"" then
StyleChk(0)=""
StyleChk(1)=" checked "
else
StyleChk(0)=" checked "
StyleChk(1)=""
end if
CheckErr
%>
<html>
<head>
<title>平均值的定义</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" LANGUAGE=javascript onload="return Init()">
<form METHOD="post" name="frmData">
<table width="95%" border=0 align="center">
<tr height="35">
<td colspan=2>
<b>请确定汇总统计时平均值的计算方式</b>
</td>
</tr>
<tr>
<td width="1%">
<p align=left>
<INPUT id=AvgStyle name=AvgStyle value='0' <%=StyleChk(0)%> type =radio onclick="SetAvgStyle();">
</p>
</td>
<td width="99%">
<p align=left>
按记录数求平均
</p>
</td>
</tr>
<tr>
<td>
<p align=left>
<INPUT id=AvgStyle name=AvgStyle value='1' <%=StyleChk(1)%> type =radio onclick="SetAvgStyle();">
</p>
</td>
<td>
<p align=left>
按以下公式求平均
</p>
</td>
</tr>
<tr>
<td>
</td>
<td>
<p align=left>
<select name=DividendFieldID style='width:120px'>
<%=DividendOption%>
</select>
/
<select name=DivisorFieldID style='width:120px'>
<%=DivisorOption%>
</select>
</p>
</td>
</tr>
<tr height=40 valign="bottom">
<td colspan=2>
<table width="100%">
<tr>
<td width="20%"></td>
<td width="20%"><input id="btnSave" type="button" value="确定" name="btnSave" style="cursor:hand; WIDTH: 50px; HEIGHT: 24px" LANGUAGE="javascript" onclick="return Save()"></td>
<td width="20%"></td>
<td width="20%"><input id="btnCancel" type="button" value="取消" name="btnCancel" style="cursor:hand; WIDTH: 50px; HEIGHT: 24px" LANGUAGE="javascript" onclick="return Cancel()"></td>
<td width="20%"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -