<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"--><!--#INCLUDE FILE="../HXINCLUDE/SelectDate.asp"-->
<%
ColumnName="":Tablename="HX_CompanyUser":Tablename1="HX_AttendanceDuty":Tablename2="HX_AttendanceNoDutyMan":Tablename3="HX_AttendanceInterval":Tablename4="HX_AttendanceHoliday":Tablename5="HX_AttendanceDutyEnrol":Orderby=" where WS_Uid="&loginuid&""
set urs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
if not conn.execute("select * from HX_AttendanceNoDutyMan where WS_AttendanceNoDutyManID="&loginuid).eof then:response.Write "<br><br><br><font color=red>您是免签人员，无需登记</font>":response.end
if not conn.execute("select * from HX_AttendanceDuty where WS_AttendanceGeneral like '%"&(weekday(date)-1)&"%' and WS_ATID="&urs("WS_Duty")).eof then:response.Write "<br><br><br><font color=red>今天是公休日，无需登记</font>":response.end
if not conn.execute("select * from HX_AttendanceHoliday where WS_AttendanceHolidayStartDate<=#"&date&"# and WS_AttendanceHolidayEndDate>=#"&date&"#").eof then:response.Write "<br><br><br><font color=red>今天是节假日，无需登记</font>":response.end
set rs=WS_S.HX_SetRSD(ColumnName,Tablename1," where WS_ATID="&urs("WS_Duty"))
if rs.recordcount<=0 then
  HX_GoBack "设置错误，请与管理员联系！","" 
end if
Orderby=""
set irs=WS_S.HX_SetRSD(ColumnName,Tablename3,Orderby)
set Enrs=WS_S.HX_SetRSD(ColumnName,Tablename5," where WS_AttendanceManID="&loginuid&" and WS_AttendanceDate=#"&date&"#")
action=request("action")
if action="REGISTER" then
   conn.execute("update "&Tablename5&" set WS_Attendance"&request("Type")&"=#"&TimeValue(time)&"#,WS_Attendance"&request("Type")&"Type="&rs("WS_Attendance"&request("Type")&"Type")&",WS_Attendance"&request("Type")&"IP='"&Request.ServerVariables("REMOTE_ADDR")&"',WS_AttendanceDate=#"&date&"# where WS_ATID="&request("ATID"))
   WS_S.HX_Redirect "AttendanceDutyEnrol.asp"
end if 
  response.Write "<head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><title>今日上下班登记</title><link rel=stylesheet type=text/css href='../HXinclude/HX_Style.css'><script src='../HXinclude/HX_Function.js'></script></head><body topmargin='20' leftmargin='0' bottommargin='0'><table width='582'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#613c25'><tr><td colspan='2' bgcolor=FFFBE8 background='../hximages/titlelinebg.gif'><table width='580'  border='0' cellspacing='0' cellpadding='0'><tr><td height='25' background='../hximages/titleline.gif' class='td4'><font class='fontmenu'>今日上下班登记</font>("&rs("WS_AttendanceName")&")</td></tr></table><table width='100%'  border='0' cellspacing='1' cellpadding='0' bgcolor='#FFFBE8'><tr><td height='22' align='center'>"
  if irs.recordcount>0 then
	  IntervalStart=irs("WS_AttendanceIntervalStart")
	  IntervalEnd=irs("WS_AttendanceIntervalEnd")
	  response.Write "<div align='center' title='提示信息框'><span style='BACKGROUND:#EEEEEE;COLOR:#FF6633;margin: 10px;border:1px dotted #FF6633;font-weight:bold;padding:8px;width=200'>规定时间之前 "&IntervalStart&" 分钟，之后 "&IntervalEnd&" 分钟起可进行登记</span></div>"
   end if
	 response.Write "<table width='100%'  border='0' cellspacing='1' cellpadding='3' bgcolor='613c25'><tr bgcolor='#6C8DBE' class='td4'><td width='20%' align='center' nowrap>登记次序</td><td width='20%' align='center' nowrap>登记类型</td><td width='23%' align='center' nowrap>规定时间</td><td width='24%' align='center' nowrap>登记时间</td><td width='13%' align='center' nowrap>操作</td></tr>"
	if Enrs.recordcount<=0 then
	  Enrs.addnew:Enrs("WS_AttendanceManID")=loginuid:Enrs("WS_AttendanceDate")=date:Enrs.update
	end if 
	msg=""
	if rs("WS_AttendanceFirst")<>"" then
	msg=WS_S.HX_OutAttendanceDuty(rs("WS_AttendanceFirstType"))&"登记"
	response.Write "<tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td nowrap align='center'>第1次登记</td><td nowrap align='center'>"&msg&"</td><td nowrap align='center'>"&rs("WS_AttendanceFirst")&"</td><td nowrap align='center'>"
	if isdate(Enrs("WS_AttendanceFirst")) then response.write Enrs("WS_AttendanceFirst") else response.write "未登记"
	 response.Write "</td><td nowrap align='center'>"
	  StartTime=TimeSerial(hour(rs("WS_AttendanceFirst")),minute(rs("WS_AttendanceFirst"))-IntervalStart,second(rs("WS_AttendanceFirst")))
	  EndTime=TimeSerial(hour(rs("WS_AttendanceFirst")),minute(rs("WS_AttendanceFirst"))+IntervalEnd,second(rs("WS_AttendanceFirst")))
	  if TimeValue(time)>=StartTime and TimeValue(time)<=EndTime and isnull(Enrs("WS_AttendanceFirst")) then
	    response.write "<a href='?action=REGISTER&Type=First&ATID="&Enrs("WS_ATID")&"'>"&msg&"</a>"
	  else
	    response.write "无"	
	  end if
	  response.Write "</td></tr>"
   end if
   
	msg=""
	if rs("WS_AttendanceSecond")<>"" then
	msg=WS_S.HX_OutAttendanceDuty(rs("WS_AttendanceSecondType"))&"登记"
	response.Write "<tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td nowrap align='center'>第2次登记</td><td nowrap align='center'>"&msg&"</td><td nowrap align='center'>"&rs("WS_AttendanceSecond")&"</td><td nowrap align='center'>"
	if isdate(Enrs("WS_AttendanceSecond")) then response.write Enrs("WS_AttendanceSecond") else response.write "未登记"
	 response.Write "</td><td nowrap align='center'>"
	  StartTime=TimeSerial(hour(rs("WS_AttendanceSecond")),minute(rs("WS_AttendanceSecond"))-IntervalStart,second(rs("WS_AttendanceSecond")))
	  EndTime=TimeSerial(hour(rs("WS_AttendanceSecond")),minute(rs("WS_AttendanceSecond"))+IntervalEnd,second(rs("WS_AttendanceSecond")))
	  if TimeValue(time)>=StartTime and TimeValue(time)<=EndTime and isnull(Enrs("WS_AttendanceSecond")) then
	    response.write "<a href='?action=REGISTER&Type=Second&ATID="&Enrs("WS_ATID")&"'>"&msg&"</a>"
      else
	    response.write "无"	
	  end if
   response.Write "</td></tr>"
   end if
	msg=""
	if rs("WS_AttendanceThird")<>"" then
	msg=WS_S.HX_OutAttendanceDuty(rs("WS_AttendanceThirdType"))&"登记"
	response.Write "<tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td nowrap align='center'>第3次登记</td><td nowrap align='center'>"&msg&"</td><td nowrap align='center'>"&rs("WS_AttendanceThird")&"</td><td nowrap align='center'>"
	if isdate(Enrs("WS_AttendanceThird")) then response.write Enrs("WS_AttendanceThird") else response.write "未登记"
	 response.Write "</td><td nowrap align='center'>"
	  StartTime=TimeSerial(hour(rs("WS_AttendanceThird")),minute(rs("WS_AttendanceThird"))-IntervalStart,second(rs("WS_AttendanceThird")))
	  EndTime=TimeSerial(hour(rs("WS_AttendanceThird")),minute(rs("WS_AttendanceThird"))+IntervalEnd,second(rs("WS_AttendanceThird")))
	  if TimeValue(time)>=StartTime and TimeValue(time)<=EndTime and isnull(Enrs("WS_AttendanceThird")) then
	    response.write "<a href='?action=REGISTER&Type=Third&ATID="&Enrs("WS_ATID")&"'>"&msg&"</a>"
      else
	    response.write "无"	
	  end if
	  response.Write "</td></tr>"
	end if
	msg=""
	if rs("WS_AttendanceFourth")<>"" then
	msg=WS_S.HX_OutAttendanceDuty(rs("WS_AttendanceFourthType"))&"登记"
	response.Write "<tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td nowrap align='center'>第4次登记</td><td nowrap align='center'>"&msg&"</td><td nowrap align='center'>"&rs("WS_AttendanceFourth")&"</td><td nowrap align='center'>"
	if isdate(Enrs("WS_AttendanceFourth")) then response.write Enrs("WS_AttendanceFourth") else response.write "未登记"
	 response.Write "</td><td nowrap align='center'>"
	  StartTime=TimeSerial(hour(rs("WS_AttendanceFourth")),minute(rs("WS_AttendanceFourth"))-IntervalStart,second(rs("WS_AttendanceFourth")))
	  EndTime=TimeSerial(hour(rs("WS_AttendanceFourth")),minute(rs("WS_AttendanceFourth"))+IntervalEnd,second(rs("WS_AttendanceFourth")))
	  if TimeValue(time)>=StartTime and TimeValue(time)<=EndTime and isnull(Enrs("WS_AttendanceFourth")) then
	    response.write "<a href='?action=REGISTER&Type=Fourth&ATID="&Enrs("WS_ATID")&"'>"&msg&"</a>"
	  else
	    response.write "无"	
	  end if
	  response.Write "</td></tr>"
	end if
	msg=""
	if rs("WS_AttendanceFive")<>"" then
	msg=WS_S.HX_OutAttendanceDuty(rs("WS_AttendanceFiveType"))&"登记"
	response.Write "<tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td nowrap align='center'>第5次登记</td><td nowrap align='center'>"&msg&"</td><td nowrap align='center'>"&rs("WS_AttendanceFive")&"</td><td nowrap align='center'>"
	if isdate(Enrs("WS_AttendanceFive")) then response.write Enrs("WS_AttendanceFive") else response.write "未登记"
	 response.Write "</td><td nowrap align='center'>"
	  StartTime=TimeSerial(hour(rs("WS_AttendanceFive")),minute(rs("WS_AttendanceFive"))-IntervalStart,second(rs("WS_AttendanceFive")))
	  EndTime=TimeSerial(hour(rs("WS_AttendanceFive")),minute(rs("WS_AttendanceFive"))+IntervalEnd,second(rs("WS_AttendanceFive")))
	  if TimeValue(time)>=StartTime and TimeValue(time)<=EndTime and isnull(Enrs("WS_AttendanceFive")) then
	    response.write "<a href='?action=REGISTER&Type=Five&ATID="&Enrs("WS_ATID")&"'>"&msg&"</a>"
      else
	    response.write "无"	
	  end if
	  response.Write "</td></tr>"
	end if
	msg=""
	if rs("WS_AttendanceSix")<>"" then
	msg=WS_S.HX_OutAttendanceDuty(rs("WS_AttendanceSixType"))&"登记"
	response.Write "<tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td nowrap align='center'>第6次登记</td><td nowrap align='center'>"&msg&"</td><td nowrap align='center'>"&rs("WS_AttendanceSix")&"</td><td nowrap align='center'>"
	if isdate(Enrs("WS_AttendanceSix")) then response.write Enrs("WS_AttendanceSix") else response.write "未登记"
	 response.Write "</td><td nowrap align='center'>"
	  StartTime=TimeSerial(hour(rs("WS_AttendanceSix")),minute(rs("WS_AttendanceSix"))-IntervalStart,second(rs("WS_AttendanceSix")))
	  EndTime=TimeSerial(hour(rs("WS_AttendanceSix")),minute(rs("WS_AttendanceSix"))+IntervalEnd,second(rs("WS_AttendanceSix")))
	  if TimeValue(time)>=StartTime and TimeValue(time)<=EndTime and isnull(Enrs("WS_AttendanceSix")) then
	    response.write "<a href='?action=REGISTER&Type=Six&ATID="&Enrs("WS_ATID")&"'>"&msg&"</a>"
      else
	    response.write "无"	
	  end if
	  response.Write "</td></tr>"
	end if
	response.Write "</table></td></tr></table></td></tr></table>"
	WS_S.HX_RSClose ATRS:WS_S.HX_RSClose rs%>