<!--#include file="../Conn.asp" -->
<!--#include file="../Comm/Site_Class.asp" -->
<%
Dim strMenu,PageTitle
strMenu = ""
PagePath = "../"

Set Qsite = New Site_Class

Qsite.SiteConfig()
Qsite.GotoErrPage()

PageTitle = Qsite.SiteName & " - 企业会员管理中心"

Qsite.Nav_Company()
%>
<!--#include file="Check_Login.asp" -->
<%
Dim Rs,Rs2,i,ThisYear,ThisMonth,ThisDay,selYear,selMonth,selDay
Dim RecruitId,JobType,Position_b,Position_s,JobName,Quantity,Salary
Dim ValidityYear,ValidityMonth,ValidityDay,Province,City,County
Dim Qualification,WorkExp,Sex,AgeBegin,AgeEnd,JobNote
Dim ValidityDate
Dim strDate,strYear,strMonth,strDay
Set Rs = server.CreateObject("ADODB.recordset")
Set Rs2 = server.CreateObject("ADODB.recordset")

If Request.Form <> "" Then
	RecruitId = Qsite.chgStr(Trim(Request.Form("RecruitId")))
	JobType = Qsite.chgStr(Trim(Request.Form("JobType")))
	Position_b = Qsite.chgStr(Trim(Request.Form("Position_b")))
	Position_s = Qsite.chgStr(Trim(Request.Form("Position_s")))
	JobName = Qsite.chgStr(Trim(Request.Form("JobName")))
	Quantity = Qsite.chgStr(Trim(Request.Form("Quantity")))
	Salary = Qsite.chgStr(Trim(Request.Form("Salary")))
	ValidityYear = Qsite.chgStr(Trim(Request.Form("ValidityYear")))
	ValidityMonth = Qsite.chgStr(Trim(Request.Form("ValidityMonth")))
	ValidityDay = Qsite.chgStr(Trim(Request.Form("ValidityDay")))
	Province = Qsite.chgStr(Trim(Request.Form("Province")))
	City = Qsite.chgStr(Trim(Request.Form("City")))
	County = Qsite.chgStr(Trim(Request.Form("County")))
	Qualification = Qsite.chgStr(Trim(Request.Form("Qualification")))
	WorkExp = Qsite.chgStr(Trim(Request.Form("WorkExp")))
	Sex = Qsite.chgStr(Trim(Request.Form("Sex")))
	AgeBegin = Qsite.chgStr(Trim(Request.Form("AgeBegin")))
	AgeEnd = Qsite.chgStr(Trim(Request.Form("AgeEnd")))
	JobNote = Qsite.chgStr(Trim(Request.Form("JobNote")))
	
	If RecruitId = "" Or IsNull(RecruitId) Or Not IsNumeric(RecruitId) Then RecruitId = 0
	
	If JobType = "" Or IsNull(JobType) Then
		Qsite.ShowMsg "请选择职位类型" , ""
	End If
	If Position_b = "" Or IsNull(Position_b) Or Position_s = "" Or IsNull(Position_s) Then
		Qsite.ShowMsg "请选择职位类别" , ""
	End If
	If JobName = "" Or IsNull(JobName) Then
		Qsite.ShowMsg "请输入职位名称" , ""
	End If
	If Quantity = "" Or IsNull(Quantity) Or Not IsNumeric(Quantity) Then
		Qsite.ShowMsg "请输入招聘人数，只能输入数字，0表示若干人" , ""
	End If
	If Salary = "" Or IsNull(Salary) Or Not IsNumeric(Salary) Then
		Qsite.ShowMsg "请输入薪资待遇，只能输入数字，0表示面议" , ""
	End If
	
	strDate = Date()
	strYear = Year(strDate)
	strMonth = Month(strDate)
	strDay = Day(strDate)
	If ValidityYear < strYear Then
		Qsite.ShowMsg "截止日期不能是过去时间" , ""
	End If
	If ValidityYear = strYear And ValidityMonth < strMonth Then
		Qsite.ShowMsg "截止日期不能是过去时间" , ""
	End If
	If ValidityYear = strYear And ValidityMonth = strMonth And ValidityDay < strDay Then
		Qsite.ShowMsg "截止日期不能是过去时间" , ""
	End If
	
	If Province = "" Or IsNull(Province) Or City = "" Or IsNull(City) Then
		Qsite.ShowMsg "请选择工作地区" , ""
	End If
	
	If Qualification = "" Or IsNull(Qualification) Then
		Qsite.ShowMsg "请选择学历要求" , ""
	End If
	If WorkExp = "" Or IsNull(WorkExp) Then
		Qsite.ShowMsg "请选择工作经验" , ""
	End If
	If Sex = "" Or IsNull(Sex) Then
		Qsite.ShowMsg "请选择性别要求" , ""
	End If
	If AgeBegin <> "不限" And AgeEnd <> "不限" And AgeBegin > AgeEnd Then
		Qsite.ShowMsg "年龄要求中，开始年龄不能大于结束年龄" , ""
	End If
	If JobNote = "" Or IsNull(JobNote) Then
		Qsite.ShowMsg "请输入具体说明" , ""
	End If
	
	ValidityDate = ValidityYear & "-" & ValidityMonth & "-" & ValidityDay
	
	If Not IsDate(ValidityDate) Then
		Qsite.ShowMsg "输入的日期不是有效日期" , ""
	End If
	
	Rs.Open "select * from RecruitTbl where RecruitId = "& RecruitId &" and ComId = "& Session("ComId") , Conn , 3 , 2
		Rs("JobType") = JobType
		Rs("Position_b") = Position_b
		Rs("Position_s") = Position_s
		Rs("JobName") = JobName
		Rs("Quantity") = Quantity
		Rs("Salary") = Salary
		Rs("ValidityDate") = Qsite.FormatDate(ValidityDate)
		Rs("Province") = Province
		Rs("City") = City
		Rs("County") = County
		Rs("Qualification") = Qualification
		Rs("WorkExp") = WorkExp
		Rs("Sex") = Sex
		Rs("AgeBegin") = AgeBegin
		Rs("AgeEnd") = AgeEnd
		Rs("JobNote") = JobNote
		Rs("EditDate") = Qsite.FormatDate(Now())
		Rs.Update
	Rs.Close
	
	Conn.Execute("update CompanyTbl set EditDate = '"& Qsite.FormatDate(Now()) &"' where ComId = "& Session("ComId"))
	
	Qsite.ShowMsg "职位修改成功" , "Job_Manage.asp"
	
End If

RecruitId = Qsite.chgStr(Trim(Request.QueryString("RecruitId")))

If RecruitId = "" Or IsNull(RecruitId) Or Not IsNumeric(RecruitId) Then RecruitId = 0

Rs.Open "select * from RecruitTbl where RecruitId = "& RecruitId &" and ComId = "& Session("ComId") , Conn , 1 , 1
If Rs.Eof Then
	JobType = ""
	Position_b = ""
	Position_s = ""
	JobName = ""
	Quantity = ""
	Salary = ""
	ValidityDate = ""
	Province = ""
	City = ""
	County = ""
	Qualification = ""
	WorkExp = ""
	Sex = ""
	AgeBegin = ""
	AgeEnd = ""
	JobNote = ""
Else
	JobType = Rs("JobType")
	Position_b = Rs("Position_b")
	Position_s = Rs("Position_s")
	JobName = Rs("JobName")
	Quantity = Rs("Quantity")
	Salary = Rs("Salary")
	ValidityDate = Rs("ValidityDate")
	Province = Rs("Province")
	City = Rs("City")
	County = Rs("County")
	Qualification = Rs("Qualification")
	WorkExp = Rs("WorkExp")
	Sex = Rs("Sex")
	AgeBegin = Rs("AgeBegin")
	AgeEnd = Rs("AgeEnd")
	JobNote = Rs("JobNote")
End If
Rs.Close

If IsDate(ValidityDate) Then
	SelYear = Year(ValidityDate)
	selMonth = Month(ValidityDate)
	selDay = Day(ValidityDate)
End If

ThisYear = Year(Date())
%>
 <table width="974" height="413" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr> 
        <td width="181" valign="top"> 
<!--#include file="Left_Menu.asp" -->
         </td>
        <td width="793" align="left" valign="top">
<script language="javascript" src="../Comm/Job_All.js"></script>
<script language="javascript" src="../Comm/Job_Function.js"></script>
<script language="javascript" src="../Comm/Area_All.js"></script>
<script language="javascript" src="../Comm/Area_Function.js"></script>
<script language="javascript" src="../Comm/Comm.js"></script>
<script language="javascript">
	function CheckForm()
	{
		if(JobForm.JobType[0].checked == false && JobForm.JobType[1].checked == false && JobForm.JobType[2].checked == false)
		{
			alert("请选择职位类型");
			return false;
		}
		if(JobForm.Position_b.value == "")
		{
			alert("请选择职位大类");
			return false;
		}
		if(JobForm.Position_s.value == "")
		{
			alert("请选择职位小类");
			return false;
		}
		if(!checkLength("JobName" , "职位名称" , 1 , 100))
			return false;
		if(!checkLength("Quantity" , "招聘人数" , 1 , 10))
			return false;
		if(!checkInteger("Quantity" , "招聘人数" , 0 , "*"))
			return false;
		if(!checkLength("Salary" , "薪资待遇" , 1 , 10))
			return false;
		if(!checkInteger("Salary" , "薪资待遇" , 0 , "*"))
			return false;
		var strDate = new Date();
		var strYear = strDate.getYear();
		var strMonth = strDate.getMonth() + 1;
		var strDay = strDate.getDate();
		if(JobForm.ValidityYear.value < strYear)
		{
			alert("截止日期不能是过去时间");
			return false;
		}
		if(JobForm.ValidityYear.value == strYear && JobForm.ValidityMonth.value < strMonth)
		{
			alert("截止日期不能是过去时间");
			return false;
		}
		if(JobForm.ValidityYear.value == strYear && JobForm.ValidityMonth.value == strMonth && JobForm.ValidityDay.value < strDay)
		{
			alert("截止日期不能是过去时间");
			return false;
		}
		if(JobForm.Province.value == "")
		{
			alert("请选择工作地区");
			return false;
		}
		if(JobForm.City.value == "")
		{
			alert("请选择工作地区");
			return false;
		}
		if(JobForm.AgeBegin.value != "不限" && JobForm.AgeEnd.value != "不限" && JobForm.AgeBegin.value > JobForm.AgeEnd.value)
		{
			alert("年龄要求中，开始年龄不能大于结束年龄");
			return false;
		}
		if(!checkLength("JobNote" , "具体要求" , 1 , 1000))
			return false;
		return true;
	}
</script>
<table width="768" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td height="26" background="../images/Member_Center_r7_c8.jpg"><table width="768" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="60">&nbsp;</td>
                    <td width="708"><span style="font-size:14px;color:#FF7706"><b>招聘职位编辑</b></span><span style="font-size:14px;color:#333333"> 
                      <strong>EditJobs</strong></span></td>
                  </tr>
                </table></td>
            </tr>
            <tr>
              <td height="136" align="left" valign="top" background="../images/Member_Center_r10_c8.jpg" style="padding-top:5px;padding-left:10px;padding-right:10px;padding-bottom:5px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr> 
                    <td width="100%" height="23"><img src="../images/ico_2.gif" width="15" height="12" align="absmiddle" />友情提示：本系统保留过期职位三个月，三月后，系统将自动删除过期职位！</td>
                  </tr>
                </table>
                <table width="100%" height="7" border="0" cellpadding="0" cellspacing="0">
                  <tr height="1">
                    <td background="../images/ico_point.gif"></td>
                  </tr>
				  <tr height="6">
                    <td></td>
                  </tr>
                </table>
							<form id="JobForm" name="JobForm" method="post" action="Job_Edit.asp" style="margin:0" onsubmit="return CheckForm();">
								<table width="82%" align=center border="0" cellpadding="5" cellspacing="3">
										<tr>
											<td width="14%" height="30" ><font color="#FF0000">*</font>职位类型：</td>
											<td width="86%" height="30" ><input name="JobType" type="radio" value="全职" <%If JobType = "全职" Then Response.Write("checked")%> />
												全职 
												<input type="radio" name="JobType" value="兼职" <%If JobType = "兼职" Then Response.Write("checked")%> />
												兼职 
												<input type="radio" name="JobType" value="全职、兼职均可" <%If JobType = "全职、兼职均可" Then Response.Write("checked")%> />
												全职、兼职均可
											<input name="RecruitId" type="hidden" id="RecruitId" value="<%=RecruitId%>" /></td>
										</tr>
										<tr>
											<td height="30" ><font color="#FF0000">*</font>职位类别：</td>
											<td height="30" ><select name="Position_b" class="input_bk_D2D2D2" id="Position_b" onChange="SelectChange('Position_s' , document.all.Position_b.options[document.all.Position_b.selectedIndex].value , arrPosition_b , arrPosition_s);">
												<option value="">-请选择职位大类-</option>
											</select>
												<select name="Position_s" class="input_bk_D2D2D2" id="Position_s">
													<option value="">-请选择职位小类-</option>
												</select>
											</td>
										</tr>
										<tr>
											<td height="30" ><font color="#FF0000">*</font>职位名称：</td>
											<td height="30" ><input name="JobName" type="text" class="input_bk_D2D2D2" id="JobName" value="<%=JobName%>" /></td>
										</tr>
										<tr>
											<td height="30" ><font color="#FF0000">*</font>招聘人数：</td>
											<td height="30" ><input name="Quantity" type="text" class="input_bk_D2D2D2" id="Quantity" value="<%=Quantity%>" />
											人（0表示若干人）</td>
										</tr>
										<tr>
											<td height="30" ><font color="#FF0000">*</font>薪资待遇：</td>
											<td height="30" ><input name="Salary" type="text" class="input_bk_D2D2D2" id="Salary" value="<%=Salary%>" />
											元/月（0表示面议）</td>
										</tr>
										<tr>
											<td height="30" ><font color="#FF0000">*</font>截止日期：</td>
											<td height="30" ><select name="ValidityYear" class="input_bk_D2D2D2" id="ValidityYear">
												<%
												For i = ThisYear To ThisYear + 10
													Response.Write("<option value="""& i &""" ")
													If Cint(i) = Cint(selYear) Then Response.Write(" selected")
													Response.Write(">"& i &"</option>")
												Next
												%>
											</select>
												年
												<select name="ValidityMonth" class="input_bk_D2D2D2" id="ValidityMonth">
													<%
													For i = 1 To 12
														Response.Write("<option value="""& i &""" ")
														If Cint(i) = Cint(selMonth) Then Response.Write(" selected")
														Response.Write(">"& i &"</option>")
													Next
													%>
												</select>
												月
												 <select name="ValidityDay" class="input_bk_D2D2D2" id="ValidityDay">
												 	<%
													For i = 1 To 31
														Response.Write("<option value="""& i &""" ")
														If Cint(i) = Cint(selDay) Then Response.Write(" selected")
														Response.Write(">"& i &"</option>")
													Next
													%>
												</select>
												 日
											</td>
										</tr>
										<tr>
											<td height="30" ><font color="#FF0000">*</font>工作地区：</td>
											<td height="30" ><select name="Province" class="input_bk_D2D2D2" id="Province" onChange="SelChgCity('City' , document.all.Province.options[document.all.Province.selectedIndex].value , arrProvince , arrCity , 'County');">
											</select>
												<select name="City" class="input_bk_D2D2D2" id="City" onChange="SelChgCounty('County' , document.all.City.options[document.all.City.selectedIndex].value , arrCity , arrCounty);">
												</select>
												 <select name="County" class="input_bk_D2D2D2" id="County">
												</select>
											</td>
										</tr>
										<tr>
											<td height="30" ><font color="#FF0000">*</font>学历要求：</td>
											<td height="30" ><select name="Qualification" class="input_bk_D2D2D2" id="Qualification">
												<option value="不限" <%If Qualification = "不限" Then Response.Write("selected")%>>不限</option>
												<%
						Rs.Open "select * from QualificationTbl order by QualificationId asc" , Conn , 1 , 1
						Do While Not Rs.Eof
							Response.Write("<option value="""& Rs("QualificationName") &""" ")
							If Rs("QualificationName") = Qualification Then Response.Write("selected")
							Response.Write(">"& Rs("QualificationName") &"</option>")
						Rs.MoveNext
						Loop
						Rs.Close
						%>
											</select>
											</td>
										</tr>
										<tr>
											<td height="30" ><font color="#FF0000">*</font>工作经验：</td>
											<td height="30" ><select name="WorkExp" class="input_bk_D2D2D2" id="WorkExp">
												<option value="不限" <%If WorkExp = "不限" Then Response.Write("selected")%>>不限</option>
												<%
												Rs.Open "select * from WorkExpSelTbl order by WorkExpSelId asc" , Conn , 1 , 1
												Do While Not Rs.Eof
													Response.Write("<option value="""& Rs("WorkExpSelName") &""" ")
													If Rs("WorkExpSelName") = WorkExp Then Response.Write("selected")
													Response.Write(">"& Rs("WorkExpSelName") &"</option>")
												Rs.MoveNext
												Loop
												Rs.Close
												%>
											</select>
											</td>
										</tr>
										<tr>
											<td height="30" ><font color="#FF0000">*</font>性别要求：</td>
											<td height="30" ><select name="Sex" class="input_bk_D2D2D2" id="Sex">
												<option value="不限" <%If Sex = "不限" Then Response.Write("selected")%>>不限</option>
												<option value="男" <%If Sex = "男" Then Response.Write("selected")%>>男</option>
												<option value="女" <%If Sex = "女" Then Response.Write("selected")%>>女</option>
											</select>
											</td>
										</tr>
										<tr>
											<td height="30" ><font color="#FF0000">*</font>年龄要求：</td>
											<td height="30" ><select name="AgeBegin" class="input_bk_D2D2D2" id="AgeBegin">
												<option value="不限" <%If AgeBegin = "不限" Then Response.Write("selected")%>>不限</option>
												<%
												For i = 18 To 60
													Response.Write("<option value="""& i &""" ")
													If Cstr(i) = Cstr(AgeBegin) Then Response.Write("selected")
													Response.Write(">"& i &"</option>")
												Next
												%>
											</select>
											至
											<select name="AgeEnd" class="input_bk_D2D2D2" id="AgeEnd">
												<option value="不限" <%If AgeEnd = "不限" Then Response.Write("selected")%>>不限</option>
												<%
												For i = 18 To 60
													Response.Write("<option value="""& i &""" ")
													If Cstr(i) = Cstr(AgeEnd) Then Response.Write("selected")
													Response.Write(">"& i &"</option>")
												Next
												%>
											</select>
											</td>
										</tr>
										<tr>
											<td height="30" ><font color="#FF0000">*</font>具体要求：</td>
											<td height="30" ><textarea name="JobNote" cols="60" rows="8" class="input_bk_D2D2D2" id="JobNote"><%=JobNote%></textarea></td>
										</tr>
										<tr>
											<td height="30">&nbsp;</td>
											<td height="30"><input type="submit" name="Submit" value=" 修  改 " />
												&nbsp;
												<input type="reset" name="Submit" value=" 重  置 " /> &nbsp;
											<input type="button" name="Submit" value=" 返  回 " onclick="javascript:location.href='Job_Manage.asp';" /></td>
										</tr>
								</table>
							</form> 
<script language="javascript">
	InitPosition("Position_b" , "Position_s" , arrPosition_b , arrPosition_s , "<%=Position_b%>" , "<%=Position_s%>")
	InitArea("Province" , "City" , "County" , arrProvince , arrCity , arrCounty , "<%=Province%>" , "<%=City%>" , "<%=County%>")
</script>
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0">
                  <tr height="1">  
                    <td background="../images/ico_point.gif"></td>
                  </tr>
                </table></td>
            </tr>
            <tr height="14">
              <td height="14" background="../images/Member_Center_r18_c8.jpg"></td>
            </tr>
          </table></td>
      </tr>
    </table>
 
<table width="974" height="8" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr height="8">
        <td height="8"></td>
      </tr>
    </table>
<%
Qsite.Bottom()
%>