⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setcondition.asp

📁 学生档案与成绩管理(1)学生档案管理:记录每个学生的档案信息
💻 ASP
字号:
<!-- #include file = "../../../include/asphead.asp" -->
<!-- #include file = "../../../include/calendar.asp" -->
<style type="text/css">
	#FieldToConditionSelect {position:absolute;visibility:hidden;left:0;top:0;width:0;height:0;z-index:-1}
	#AllConditionDetail {position:absolute;visibility:hidden;left:0;top:0;width:0;height:0;z-index:-1}
</style>    
<link href="../../../include/main.css" rel="stylesheet" type="text/css">
<script src="../../../include/function.js" type="text/javascript"></script>
<script src="../../../include/formulaedit.js" type="text/javascript"></script>
<script ID="clientEventHandlersJS" LANGUAGE="javascript">
<!--
	var ConditionDataType;
	
	//根据公式数据,初始化公式设置的界面,Description,FieldToFormulaSelect
	function InitFormula() 
	{
		var FormulaStr;	//公式内部结构串,Condition ItemSep SQLDesc ItemSep Divisor
						//其中的Condition,采用与查询条件类似的结构:Fldxxx ConItemSep Value GroupSep Fldxxx ConItemSep Value
		if (window.dialogArguments != null)
		{
			FormulaStr=JTrim(window.dialogArguments[0]);
			FieldToFormulaSelect.innerHTML =window.dialogArguments[1];
			FieldToConditionSelect.innerHTML =window.dialogArguments[2];
			ConditionDataType =window.dialogArguments[3].split(",");
			AllConditionDetail.innerHTML =window.dialogArguments[4];
		}

		frmData.Condition.value=''
		frmData.ConditionDesc.value=''
		frmData.Description.value=''
		if(FormulaStr!='')
		{
			var parts
			parts=FormulaStr.split(ItemSep);
			if(parts.length>0)
			{
				//初始化条件部分
				if(!isEmpty(parts[0]))
				{
					frmData.Condition.value=parts[0];
					frmData.ConditionDesc.value=FormatConditionToCaption(parts[0]);
				}
				//初始化公式内容
				frmData.Description.value=FormatToCaption(parts[1]);
			}
		}
	}	
	
	//表达式中的字段id还原成字段名称[XXX],用于在页面中显示
	function FormatToCaption(Desc) 
	{
		var Count,Caption,FieldID;
		Count=FieldToCondition.length
		for(var i=1;i<=Count-1;i++)	//抛弃了最前面的空选项
		{
			Caption=FieldToCondition[i].text;
			Caption='['+Caption+']';
			FieldID=FieldToCondition[i].value;
			FieldID='[Fld'+FieldID+']';
			Desc=replace(Desc,FieldID,Caption);
		}
		return(Desc);
	}
	
	//设置公式条件
	function PopSetCondition() 
	{
		var ret,CurCondition;
		CurCondition=frmData.Condition.value;
		CurCondition=replace(CurCondition,GroupSep,JoinChar)	//GroupSep不能通过QueryString传递,暂时用JoinChar代替
		ret=window.showModalDialog ("condition.asp?CurCondition="+CurCondition,"Setting","dialogwidth:470px;dialogheight:445px;Status:0;center:1;resizable=1;");
		if(typeof(ret)!="undefined" && ret!=false)
		{
			if(ret.charAt(0)=="1")
			{
				var parts
				ret=ret.substr(2,ret.length-2);
				frmData.Condition.value=ret;
				frmData.ConditionDesc.value=FormatConditionToCaption(ret);
			}
		}
	}

	//公式数据的合法性检查(Data Check)
	function DC() 
	{
		if (JTrim(document.frmData.Description.value)=='')
		{
			alert("公式未填写,请填写。")
			return false;
		}

		if (CheckFormula()==false)
		{
			alert(FormulaErrDesc)
			return false;
		}
		else
		{
			alert("检查通过。")
			return true;
		}
	}
	
	function Save()
	{

		var Condition,SQLDesc,Divisor

		if (JTrim(document.frmData.Description.value)=='')
		{
			alert("公式未填写,请填写。")
			return false;
		}
				
		if (CheckFormula()==false)
		{
			alert(FormulaErrDesc)
			return false;
		}
		
		Condition=frmData.Condition.value;
		SQLDesc=frmData.SQLDesc.value;
		Divisor=frmData.Divisor.value;
		window.returnValue = "1,"+Condition+ItemSep+SQLDesc+ItemSep+Divisor;
		window.close();
	}
	
	function Cancel()
	{
		window.returnValue = "0";
		window.close();
	}

	function HasChange()
	{
		
	}
//-->
</script>
<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 InitFormula()">
		<form METHOD="post" name="frmData">
			<table width="100%" border=0 align=center CELLSPACING=0 CELLPADDING="0">
				<tr height="35">
					<td colspan=5>
						<b>
							设置条件数值计算项
						</b>
					</td>
				</tr>
				<tr height=105 valign="top">
					<td colspan=5>
						<table width="95%" align=center border=0 CELLSPACING="1" CELLPADDING="0">
							<tr>
								<td bgcolor="#e0e0e0" width="18%">
									<p align="left">
										计算条件
									</p>
								</td>
								<td bgcolor="white" width="82%">
									<p align="left">
										<TEXTAREA rows=3 cols=80 readOnly=true style="FONT-SIZE:10pt;" NAME=ConditionDesc value=[ConditionDesc] style="WIDTH: 335px"></TEXTAREA>
										<input TYPE="hidden" NAME=Condition>
										<INPUT type='button' value='v' onclick=PopSetCondition() id='button' name='button'>
									</p>
								</td>
							</tr>
							<tr>
								<td bgcolor="#e0e0e0">
									<p align="left">
										插入字段
									</p>
								</td>
								<td bgcolor="white">
									<p align="left" id=FieldToFormulaSelect>
									</p>
								</td>
							</tr>
							<tr>
								<td bgcolor="#e0e0e0">
									<p align="left">
										计算公式<FONT color=red>*</FONT>
									</p>
								</td>
								<td bgcolor="white">
									<p align="left">
										<INPUT TYPE="text" style='WIDTH:335px' maxLength=100 NAME="Description" ONSELECT="storeCaret();" onCLICK="storeCaret();" onKEYUP="storeCaret();">  
									</p>
								</td>
							</tr>
							<tr>
								<td bgcolor="#e0e0e0">
									<p align="left">
										公式示例
									</p>
								</td>
								<td bgcolor="white">
									<p align="left">
										<INPUT TYPE="text" style='WIDTH:335px' maxLength=100 disabled NAME="Sample" value='([基本工资]/22)*1.5*[加班天数]'>
									</p>
								</td>
							</tr>
							<tr>
								<td colspan=2>
									<p align=left>说明:公式中允许包含数值、数值型字段、+ - * / () 运算符。</p>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr height=40 valign=bottom>
					<td colspan="5">
						<table width="100%">
							<tr>
								<td width="20%"></td>
								<td width="20%"><input id="btnDC" type="button" value="检查" name="btnDC" style="cursor:hand; WIDTH: 50px; HEIGHT: 24px" LANGUAGE="javascript" onclick="return DC()"></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%"><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>
			<input TYPE="hidden" NAME="SQLDesc">
			<input TYPE="hidden" NAME="Divisor">
		</form>
		<div id=FieldToConditionSelect>
		</div>
		<div id=AllConditionDetail>
		</div>
	</body>                                                                                                           
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -