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

📄 edit.asp

📁 功能齐全的oa系统
💻 ASP
字号:
<% option explicit%>
<!-- #include virtual="include/DataEnvi.asp" -->
<!-- #include virtual="include/MyFunc.asp" -->
<!-- #include virtual="include/Page.asp" -->
<%
Dim ObjDB,StrSQL
Dim C
Dim IntID
Dim ObjRS,rs
Set ObjDB = Server.CreateObject("ADODB.Connection")
OpenDBH ObjDB
IntID = Request.QueryString("ID")
Set C = Server.CreateObject ("CMS2003.DBhandle")
C.Init(ObjDB)

Set ObjRS = C.View("Select * From v_Hrms_PersonSave Where ID = " & IntID) 
dim ComID,DepID,StationID,BComID,BDepID,BStationID,Names,Forms
ComID=ObjRS("Company")
DepID=ObjRS("Department")
StationID=ObjRS("Station")
BComID=ObjRS("ComName")
BDepID=ObjRS("DepName")
BStationID=ObjRS("StationName")
Names=ObjRS("Name")
Forms=ObjRS("Form")


If Request.Form.Count > 0 Then
	IntID = Request.Form("ID")
	Set ObjRS = Server.CreateObject("Adodb.Recordset")
	StrSQL = "Select * From t_Hrms_PersonSave Where Id='"&IntID&"'"
	ObjRS.Open StrSQL,ObjDB,1,3
	ObjRS("Name")= trim(Request("Name")) 
	ObjRS("Form")= trim(Request("Form")) 
	ObjRS("Dates")= trim(Request("Dates")) 
	ObjRS("Company")= trim(Request("Company")) 
	ObjRS("Department")= trim(Request("Department")) 
	ObjRS("Station")= trim(Request("Station")) 
	ObjRS("Des")= trim(Request("Des"))
	ObjRS("CandiNum")= trim(Request("CandiNum"))
	ObjRS.Fields("FinalEditTime")= Now()
	ObjRS.Update
	IntID = ObjRS("ID")     
	'添加日志
	ObjRS.close
	
	ObjRS.Open "select * from v_Hrms_PersonSave Where ID = " & IntID,ObjDB,1,1
	dim AComID,ADepID,AStationID,ANames,AForms
	AComID=ObjRS("ComName")
	ADepID=ObjRS("DepName")
	AStationID=ObjRS("StationName")
	ANames=ObjRS("Name")
	AForms=ObjRS("Form")
	ObjRS.close
	
	dim FirstMenu,SecondMenu,Opertion,OTime,OName,OIP,ODesc,OChange
	OIP=Request.ServerVariables("REMOTE_ADDR")
	if BComID<>AComID then
	OChange=OChange&"公司由"&BComID&"改变为"&AComID&"。"
	end if
	if BDepID<>ADepID then
	OChange=OChange&"部门由"&BDepID&"改变为"&ADepID&"。"
	end if
	if BStationID<>AStationID then
	OChange=OChange&"岗位由"&BStationID&"改变为"&AStationID&"。"
	end if
	if Names<>ANames then
	OChange=OChange&"主考人由"&Names&"改变为"&ANames&"。"
	end if
	if Forms<>AForms then
	OChange=OChange&"面试形式由"&Forms&"改变为"&AForms&"。"
	end if
	
	OName= Session("AccountName") 
	if OName="administrator" then
	OName="系统管理员"
	end if
	call AddLog("招聘管理","面试选拔","修改",now(),OName ,OIP,request("EditReason"),OChange,ObjDB)
	
  	ObjDB.Close
 	Set ObjDB = Nothing
  Response.Redirect "list.asp"   
End If


Sub Main
%>

<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
<!--读取分类字段赋给JS数组-->
dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from v_Hrms_Com_Dep_Sta ",ObjDB,1,1
count = 0
do while not rs.eof 
%>
subcat[<%=count%>] = new Array("<%= trim(rs("DepName"))%>","<%= rs("ComID")%>","<%= rs("DepID")%>","<%= rs("StaName")%>","<%= rs("StaID")%>");
<%
        count = count + 1
        rs.movenext
        loop
        rs.close
%>
		
onecount=<%=count%>;


function changelocation(locationid)
  	{
		document.myform.Department.length = 0; 
	
		var locationid=locationid;
		var i,j,k;
		var Subid;
		var DepID;
		var StaID;
		
		DepID = "";
		StaID = "";
		document.myform.Station.length = 0
		k=0;
		for (i=0;i < onecount; i++)
	   {
			  if (subcat[i][1] == locationid)
			 { 
				 if (DepID.indexOf(subcat[i][2]) == -1)
				{
					document.myform.Department.options[document.myform.Department.length] = new Option(subcat[i][0], subcat[i][2]);
					k=k+1;
					if (k == 1) 
					{
						Subid=subcat[i][2];
					}
				}
				DepID = DepID + "," + subcat[i][2];
			 }        
	   }
			
		for (j=0;j < onecount; j++)
		{
			if ((subcat[j][1] == locationid) && (Subid == subcat[j][2]))
			{
				if (StaID.indexOf(subcat[j][4]) == -1)
				{
						document.myform.Station.options[document.myform.Station.length] = new Option(subcat[j][3], subcat[j][4]);
				}
			StaID = StaID + "," + subcat[j][4];
			}
		}
    }    
</script> 
	  
<script language = "JavaScript">
var onecountDep;
onecountDep=0;
subcatDep = new Array();
<%
<!--读取分类字段赋给JS数组-->
dim countDep
<!-- set rs=server.createobject("adodb.recordset") -->
rs.open "select distinct* from v_Hrms_Dep_Job ",ObjDB,1,1
countDep = 0
do while not rs.eof 
%>
subcatDep[<%=countDep%>] = new Array("<%= trim(rs("JobName"))%>","<%= rs("ID")%>","<%= rs("Pos")%>");
<%
        countDep = countDep + 1
        rs.movenext
        loop
        rs.close
%>
		
onecountDep=<%=countDep%>;

function changelocationDep(locationid)
    {
    document.myform.Station.length = 0; 

    var locationid=locationid;
    var i;
    for (i=0;i < onecountDep; i++)
        {
            if (subcatDep[i][1] == locationid)
            { 
             document.myform.Station.options[document.myform.Station.length] = new Option(subcatDep[i][0], subcatDep[i][2]);
            }        
        }
        
    }    
      </script>

	<form action="" method="post" name=myform>
	<input type=hidden name=ID value="<%=Request.QueryString("ID")%>">
  <table width="100%" cellpadding=3 cellspacing=1 class=Ltable>
    <tr class=LHtr> 
      <td colspan="2" align="left">修改面试选拔</td>
    </tr>
    <tr class=Ltr> 
      <td width="13%">主考人:</td>
      <td width="85%"><input type="text" class=Input Check=1 Show="姓名" name="Name" value="<%=ObjRS("Name")%>"></td>
    </tr>
    <tr class=Ltr> 
      <td width="13%">面试日期:</td>
      <td> <input name="Dates" type="text" class=Input onClick="InputDate(this)" value="<%=DateValue(ObjRS("Dates"))%>"  readonly> 
      </td>
    </tr>
    <tr class=Ltr> 
      <td width="13%">选拔形式:</td>
      <td> <input name="Form" type="text" class=Input value="<%=ObjRS("Form")%>"> 
      </td>
    </tr>
    <tr class=Ltr> 
      <td width="13%" height="37">参加人数:</td>
      <td><input name="CandiNum" type="text" class=Input id="CandiNum" value="<%=ObjRS("CandiNum")%>" size="5">
        人 </td>
    </tr>
    <tr class=Ltr> 
      <td width="13%">应聘公司</td>
      <td> 
        <%
		dim rs1
		set rs1=server.CreateObject("adodb.recordset")
		rs1.open "select * from t_Hrms_Dep where ParentID=0",ObjDB,1,1
		if rs1.eof and rs1.bof then
			call MsgBox("请先添加公司!","Back","None")
			response.end
		else
		%>
        <select name="Company" class="SelectWidth" onChange="changelocation(document.myform.Company.options[document.myform.Company.selectedIndex].value)">
          <option  value="<%=rs1("ID")%>" selected><%=trim(rs1("DepName"))%></option>
          <% 
		 rs1.movenext
		 do while not rs1.eof
		%>
          <option value="<%=rs1("ID")%>" <%if rs1("ID")=ComID then response.Write("Selected")%>><%=trim(rs1("DepName"))%></option>
          <%
		 rs1.movenext
		 loop
		end if
		rs1.close
		'set rs1=nothing
		%>
        </select></td>
    </tr>
    <tr class=Ltr> 
      <td width="13%">应聘部门</td>
      <td> 
        <%
	  rs1.open "select * from t_Hrms_Dep where ParentID="&ComID ,ObjDB,1,1
	  %>
        <select name="Department"  class="SelectWidth"  onChange="changelocationDep(document.myform.Department.options[document.myform.Department.selectedIndex].value)">
          <%
		
		if not(rs1.eof and rs1.bof) then
		%>
          <option value="<%=rs1("ID")%>" selected><%=rs1("DepName")%></option>
          <%
		dim selDep
		selDep=rs1("ID")
		rs1.movenext
		do while not rs1.eof
		%>
          <option value="<%=rs1("ID")%>" <%if rs1("ID")=DepID then response.Write("selected")%>><%=rs1("DepName")%></option>
          <%
		rs1.movenext
		loop
		end if
		rs1.close
		set rs1 = nothing
		%>
        </select></td>
    </tr>
    <tr class=Ltr> 
      <td width="13%">应聘岗位</td>
      <td> <select name="Station" class="SelectWidth">
          <%
		rs.open "select * from v_Hrms_Dep_Job where ID="&selDep,ObjDB,1,1
		if not(rs.eof and rs.bof) then
		%>
          <option value="<%=rs("Pos")%>" selected><%=rs("JobName")%></option>
          <% rs.movenext
		do while not rs.eof
		%>
          <option value="<%=rs("Pos")%>" <%if rs("Pos")=StationID then response.Write("Selected")%>><%=rs("JobName")%></option>
          <%
		rs.movenext
		loop
		end if
		rs.close
		%>
        </select></td>
    </tr>
    <tr class=Ltr> 
      <td width="13%">入库日期</td>
      <td> <input name="CreateTime" type="text" class=Input readonly value="<%=ObjRS("CreateTime")%>" ></td>
    </tr>
    <tr class=Ltr> 
      <td width="13%">备注</td>
      <td><textarea  cols=50% rows=5 class=Textarea name="Des"><%=ObjRS("Des")%></textarea></td>
    </tr>
	<tr class=Ltr> 
      <td width="13%">修改原因</td>
      <td><textarea  cols=50% rows=5 class=Textarea name="EditReason"></textarea></td>
    </tr>
    <tr class=Ltr height=100%> 
      <td colspan=2 align="left" valign="top">
	  	<input type="submit" onClick="return checkpro();" name="IsSubmit" class=Button value="确  定"> 
        <input type="button" class=Button value="取  消" onclick="location.href='List.asp'"  name=button1></td>
    </tr>
  </table>
  <script language="JavaScript">
	function checkpro()
	{
	<!-- '公司限制 -->
		if(document.myform.Company.value =="") 
		{
		document.myform.Company.focus();
		alert("应聘公司不能为空!");
		 return false;
		}
		
		<!-- '部门限制 -->
		if(document.myform.Department.value =="") 
		{
		document.myform.Department.focus();
		alert("应聘部门不能为空!");
		 return false;
		}
		
		<!-- 岗位限制 -->
		if(document.myform.Station.value =="") 
		{
		document.myform.Station.focus();
		alert("应聘岗位不能为空!");
		 return false;
		}
		
		<!-- '申请人数 -->
		if(document.myform.CandiNum.value =="") 
		{
		document.myform.CandiNum.focus();
		alert("参加人数不能为空!");
		 return false;
		}
		if(isNaN(document.myform.CandiNum.value))
		{
			document.myform.CandiNum.focus();
			alert("参加人数必须为数字!");
			return false;
		}
		if((document.myform.CandiNum.value > 1999999999)||(document.myform.CandiNum.value < 0))
		{
			document.myform.CandiNum.focus();
			alert("参加人数必须为1到1999999999的数!");
			return false;
		}
		
		<!-- '姓名限制 -->
		if(document.myform.Name.value =="") 
		{
		document.myform.Name.focus();
		alert("主考人姓名不能为空!");
		 return false;
		}
		if(document.myform.Name.value.length >25) 
		{
			document.myform.Name.focus();
			alert("主考人姓名不能超过25个字!");
			 return false;
		}
		
		<!-- '面试日期限制 -->
		
		if(document.myform.Dates.value =="") 
		{
		document.myform.Dates.focus();
		alert("面试日期不能为空!");
		 return false;
		}
		
		<!-- '面试形式限制限制 -->
		if(document.myform.Form.value == "") 
		{
			document.myform.Form.focus();
			alert("面试形式不能为空!");
			 return false;
		}
		if(document.myform.Form.value.length > 25) 
		{
			document.myform.Form.focus();
			alert("面试形式不能超过25个字!");
			return false;
		}
	}
</Script> 
  
</form>
<%
End Sub
%>
<!-- #include file="Templet.asp" -->

⌨️ 快捷键说明

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