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

📄 addnew1.asp

📁 功能齐全的oa系统
💻 ASP
字号:
<% option explicit%>
<!-- #include virtual="include/DataEnvi.asp" -->
<!-- #include virtual="include/MyFunc.asp" -->
<!-- #include virtual="include/Roles.asp"-->
<% 
Dim ObjDB
  Dim C
  Dim IntID,ObjRS,sql
Set ObjDB = Server.CreateObject("ADODB.Connection")
OpenDB ObjDB
dim AddComID
AddComID=AddNewComID(ObjDB)
ObjDB.close

 
If Request.Form.Count > 0 Then
  
   ' ----------------------------------------判断开始'
'公司限制
if Request("Company")=""then
	%>
	<script language=javascript>
		alert("公司不能为空!");
		history.go(-1);
	</script>
	<%
		response.end
end if 

'部门限制
if Request("Department")=""then
%>
<script language=javascript>
    alert("部门不能为空!");
    history.go(-1);
</script>
<%
	response.end
end if

'岗位限制
if Request("Station")=""then
%>
<script language=javascript>
    alert("岗位不能为空!");
    history.go(-1);
</script>
<%
	response.end
end if

'申请原因限制
if Request("Reason")=""then
%>
<script language=javascript>
    alert("申请理由不能为空!");
    history.go(-1);
</script>
<%
	response.end
end if
   
   '申请人数
if Request("Number")="" then
	%>
	<script language=javascript>
		alert("招聘人数不能为空!");
		history.go(-1);
	</script>
		<%
	response.End()
else if not IsNumeric(request("Number")) then
	%>
		<script language=javascript>
			alert("招聘人数必须为整数!");
			history.go(-1);
		</script>
	<%
	response.End()
	else if request("Number")>1999999999 or request("Number")<=0 then
		%>
			<script language=javascript>
				alert("招聘人数必须为大于0小于1999999999的整数!");
				history.go(-1);
			</script>
			<%
			response.End()
		end if
	end if
end if
'希望到岗日期限制
if Request("InTime")=""then
%>
<script language=javascript>
    alert("希望到岗日期为空!");
    history.go(-1);
</script>
<%
	response.end
end if	
'岗位职责限制
if Request("Responsibility")=""then
%>
<script language=javascript>
    alert("岗位职责不能为空!");
    history.go(-1);
</script>
<%
	response.end
end if
'任职条件限制
if Request("Condition")="" then
%>
<script language=javascript>
    alert("任职条件不能为空!");
    history.go(-1);
</script>		
<%
	response.End()
end if

'备注信息限制
if len(Request("Des"))>500 then
%>
<script language=javascript>
    alert("备注信息的输入最多不能超过500个字!!");
    history.go(-1);
</script>		
<%
	response.End()
end if

 ' -------------------------------------------判断结束'
  
  OpenDBH ObjDB
   Set ObjRS = Server.CreateObject("ADODB.Recordset")
		sql="select * from t_Hrms_JobApplications_DepRequirement"
		ObjRS.open sql,ObjDB,1,3
		ObjRS.addnew
		ObjRS("Company")= Request("Company")
		ObjRS("Department")=Request("Department")
		ObjRS("Station")= Request("Station")
		ObjRS("Number")=Request("Number")
		ObjRS("Reason")=Request("Reason")
		ObjRS.Fields("InTime")=Request("InTime")
		ObjRS("Responsibility")=Request("Responsibility")
		ObjRS("Condition")=Request("Condition")
		ObjRS("Des")=Request("Des")
		ObjRS.Fields("AppTime")=Now()
		ObjRS("ReCreatorID")=AddComID
		ObjRS("State")=1
		ObjRS("AppPerson")=Session("AccountName")
		ObjRS.update
		IntID=ObjRS("ID")
		ObjRS.close
	
	'添加日志
		
		dim FirstMenu,SecondMenu,Opertion,OTime,OName,OIP,ODesc,OChange
		ObjRS.open "select * from v_Hrms_DepRequirement where ID="&IntID,ObjDB,1,1
		OChange="公司为:"&ObjRS("ComName")&",部门为:"&ObjRS("DepName")&",岗位为:"&ObjRS("JobName")&",申请理由:"&ObjRS("Reason")&",人数:"&ObjRS("Number")&",希望到岗日期:"&ObjRS("InTime")&"。"
		ObjRS.close
		OIP=Request.ServerVariables("REMOTE_ADDR")
		OName= Session("AccountName") 
		if OName="administrator" then
		OName="系统管理员"
		end if
		call AddLog("招聘管理","部门需求","新增",now(),OName ,OIP,"",OChange,ObjDB)
		ObjDB.Close
		Set ObjDB = Nothing
		Response.Redirect "List.asp"
  
End If
Sub Main
%>
<%
Dim rs
Set ObjDB = Server.CreateObject("ADODB.Connection")
OpenDBH ObjDB
%>

<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>
  <table width="100%" cellpadding=3 cellspacing=1 class=Ltable>
    <tr class=LHtr> 
      <td height="32" colspan="4" align="left">新增部门需求 </td>
    </tr>
    <tr class=Ltr> 
      <td width="15%" height="28">公司</td>
      <td width="35%"> 
        <%
		rs.open "select * from t_Hrms_Dep where ParentID=0",ObjDB,1,1
		if rs.eof and rs.bof then
			call MsgBox("请先添加公司!","Back","None")
			response.end
		else
		%>
      <select class="SelectWidth" name="Company" size="1" onChange="changelocation(document.myform.Company.options[document.myform.Company.selectedIndex].value)">
        <option selected value="<%=rs("ID")%>"><%=trim(rs("DepName"))%></option>
        <%      
		 dim selclass
		 selclass=rs("ID")
		 rs.movenext
		 do while not rs.eof
		%>
        <option value="<%=rs("ID")%>"><%=trim(rs("DepName"))%></option>
        <%
		 rs.movenext
		 loop
		end if
		rs.close
		%>
      </select> 
	  </td>
      <td width="15%">申请理由</td>
      <td width="35%">
	  <select class="SelectWidth" name="Reason">
          <%
		rs.open "select * from t_Hrms_Sys_AppReason",ObjDB,1,1
		if not(rs.eof and rs.bof) then
		%>
          <option value="<%=rs("ID")%>" selected><%=rs("Reason")%></option>
          <% rs.movenext
		do while not rs.eof
		%>
          <option value="<%=rs("ID")%>"><%=rs("Reason")%></option>
          <%
		rs.movenext
		loop
		end if
		rs.close
		%>
        </select>
	  </td>
    </tr>
    <tr class=Ltr> 
      <td width="15%" height="31">部门</td>
      <td width="35%"> 
        <select class="SelectWidth" name="Department"  onChange="changelocationDep(document.myform.Department.options[document.myform.Department.selectedIndex].value)">
        <%
		rs.open "select * from t_Hrms_Dep where ParentID="&selclass ,ObjDB,1,1
		if not(rs.eof and rs.bof) then
		%>
        <option value="<%=rs("ID")%>" selected><%=rs("DepName")%></option>
        <%
		dim selDep
		selDep=rs("ID")
		rs.movenext
		do while not rs.eof
		%>
        <option value="<%=rs("ID")%>"><%=rs("DepName")%></option>
        <%
		rs.movenext
		loop
		end if
		rs.close
		%>
      </select>  
      </td>
      <td width="15%">人数</td>
      <td width="35%"><input name="Number" type="text" class=Input value="" size="5" check=1>
        人 </td>
    </tr>
    <tr class=Ltr> 
      <td width="15%" height="32">岗位</td>
      <td width="35%"> 
        <select class="SelectWidth" name="Station">
        <%
		rs.open "select distinct StaName,StaID from v_Hrms_Com_Dep_Sta where ComID='"&selClass&"' and DepID='"&selDep&"'",ObjDB,1,1
		if not(rs.eof and rs.bof) then
		%>
        <option value="<%=rs("StaID")%>" selected><%=rs("StaName")%></option>
        <% 
		rs.movenext
		do while not rs.eof
		%>
        <option value="<%=rs("StaID")%>"><%=rs("StaName")%></option>
        <%
		rs.movenext
		loop
		end if
		rs.close
		set rs=nothing
		ObjDB.Close
		set ObjDB = nothing
		%>
      </select> 
      </td>
      <td width="15%">希望到岗日期</td>
      <td width="35%"><input name="InTime" type="text" class=Input onClick="InputDate(this)" readonly></td>
    </tr>
    <tr class=Ltr> 
      <td width="15%">岗位职责</td>
      <td colspan="3"><textArea name="Responsibility"  cols=80 rows=5 class=Textarea></textarea></td>
    </tr>
    <tr class=Ltr> 
      <td width="15%">任职条件</td>
      <td colspan="3"><textArea name="Condition"  cols=80 rows=5 class=Textarea id="Condition"></textarea></td>
    </tr>
    <tr class=Ltr> 
      <td width="15%">备注</td>
      <td colspan="3"><textArea  cols=80 rows=5 class=Textarea name="Des"></textarea></td>
    </tr>
    <tr class=Ltr height=100%> 
      <td colspan=4 align="left" valign="top"><input type="submit"  name="Submit" class=Button value="提 交"> 
        <input type="button" class=Button value="取 消" onclick="history.go(-1)" id=button1 name=button1></td>
    </tr>
  </table>
</form>
<%
End Sub
%>
<!-- #include file="Templet.asp" -->

⌨️ 快捷键说明

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