<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<!--#INCLUDE FILE="../HXINCLUDE/SelectDate.asp"-->
<%
Uid=request("Uid"):if not WS_S.HX_ISNUM(Uid) then Uid=cint(loginuid) else Uid=cint(Uid)
Orderby=" where WS_AttendanceManID="&Uid
if isdate(request("SOME_DATE")) then Orderby=Orderby&" and WS_AttendanceDate=#"&request("SOME_DATE")&"#" else Orderby=Orderby&" and WS_AttendanceDate=#"&date&"#" 
Orderby=Orderby&" order by WS_ATID asc":Orderby1=" where WS_AttendanceOutEnrolLEADERID="&Uid
if isdate(request("SOME_DATE")) then Orderby1=Orderby1&" and WS_AttendanceOutEnrolDate=#"&request("SOME_DATE")&"#" else Orderby1=Orderby1&" and WS_AttendanceOutEnrolDate=#"&date&"#"
Orderby1=Orderby1&" order by WS_AOID asc":Orderby2=" where WS_AttendanceLeaveEnrolLEADERID="&Uid
if isdate(request("SOME_DATE")) then Orderby2=Orderby2&" and WS_AttendanceLeaveEnrolDate=#"&request("SOME_DATE")&"#" else Orderby2=Orderby2&" and WS_AttendanceLeaveEnrolDate=#"&date&"#" 
Orderby2=Orderby2&" order by WS_ALID asc":Orderby3=" where WS_AttendanceEvectionEnrolLEADERID="&Uid
if isdate(request("SOME_DATE")) then Orderby3=Orderby3&" and WS_AttendanceEvectionEnrolDate=#"&request("SOME_DATE")&"#" else Orderby3=Orderby3&" and WS_AttendanceEvectionEnrolDate=#"&date&"#" 
Orderby3=Orderby3&" order by WS_AEID asc"
set adrs=WS_S.HX_SetRSD("","HX_AttendanceDutyEnrol",Orderby):set ours=WS_S.HX_SetRSD("","HX_AttendanceOutEnrol",Orderby1):set lers=WS_S.HX_SetRSD("","HX_AttendanceLeaveEnrol",Orderby2):set aers=WS_S.HX_SetRSD("","HX_AttendanceEvectionEnrol",Orderby3):set rs=WS_S.HX_SetRSD(ColumnName,"HX_CompanyUser a,HX_AttendanceDuty b"," where b.WS_ATID=a.WS_Duty and a.WS_Uid="&uid)
if isdate(request("SOME_DATE")) then dat=request("SOME_DATE") else dat=date
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 language='javascript'>function CheckForm(){if(document.form1.SOME_DATE.value==''){ alert('查询日期不能为空！');return (false);}return (true);}</script></head><body topmargin='20' leftmargin='0' bottommargin='0'><table width='611'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#613c25'><tr><td width='619' colspan='2' bgcolor=FFFBE8><table width='609'  border='0' cellspacing='0' cellpadding='0'><tr><td width='609' height='25' background='../hximages/titleline.gif'><font class='fontmenu'>考勤记录</font></td></tr></table><table width='609'  border='0' cellspacing='1' cellpadding='2' bgcolor='613c25'><form action='' name='form1' onsubmit='return CheckForm();'><tr><td width='609' height='25' bgcolor='#FFFBE8' align='center'><select name='Uid'>"
set udrs=WS_S.HX_SetRSD("","HX_CompanyUser"," where WS_leave=False order by WS_department asc")
if udrs.recordcount>0 then
do until udrs.eof
Call WS_S.HX_OutUserInfo(udrs("WS_Uid"))
response.write "<option value='"&udrs("WS_Uid")&"' "
if udrs("WS_Uid")=Uid then response.write "selected"
response.write ">"&"["&Outdepartment&OutAppointment&"]"&OutName&"</option>"
udrs.movenext
loop
end if
response.write "</select>&nbsp; &nbsp;<input type='text' name='SOME_DATE' size='10' maxlength='10' value='"&date&"' readonly> <input onclick=""popUpcalendar(this, form1.SOME_DATE, 'yyyy-mm-dd')"" type='button' value='选择' title='选择日期'> <input type='submit' value='考勤查询' title='考勤查询'></td></tr></form></table><br><table width='100%' cellspacing=1 cellpadding=3 bgcolor='#613c25'><tr bgcolor='6C8DBE' class=td4><td colspan='6'>上下班登记 ["&rs("WS_AttendanceName")&"]</td></tr><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='21%' align='center' nowrap>登记时间</td><td width='16%' align='center' nowrap>登记IP</td></tr>"	
	set Enrs=WS_S.HX_SetRSD(ColumnName,"HX_AttendanceDutyEnrol"," where WS_AttendanceManID="&uid&" and WS_AttendanceDate=#"&dat&"#")
	if Enrs.recordcount<=0 then Enrs.addnew:Enrs("WS_AttendanceManID")=uid:Enrs("WS_AttendanceDate")=date:Enrs.update
	
	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'>"&Enrs("WS_AttendanceFirstIP")&"</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'>"&Enrs("WS_AttendanceSecondIP")&"</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'>"&Enrs("WS_AttendanceThirdIP")&"</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'>"&Enrs("WS_AttendanceFourthIP")&"</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'>"&Enrs("WS_AttendanceFiveIP")&"</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'>"&Enrs("WS_AttendanceSixIP")&"</td></tr>"
	end if
	response.write "</table><br><table width='100%' cellspacing=1 cellpadding=3 bgcolor='#613c25'><tr bgcolor='6C8DBE' class=td4><td colspan='6'>外出登记</td></tr><tr bgcolor='BF9B73' class='td4'><td width='13%' align='center'>部门</td><td width='14%' align='center'>姓名</td><td width='22%' align='center'>外出原因</td><td width='26%' align='center'>外出时间</td><td width='25%' align='center'>归来时间</td></tr>"
	  if ours.recordcount<=0 then
	    response.Write "<tr><td bgcolor=FFFBE8 colspan=6 align=center>无外出记录</td></tr>"
	  else
	    do until ours.eof
		  Call WS_S.HX_OutUserInfo(ours("WS_AttendanceOutEnrolReplyID"))
	      response.write "<tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td align='center'>"&Outdepartment
	      response.write "</td><td align='center'>"&OutName&"</td><td align='center'>"&ours("WS_AttendanceOutEnrolTYPE")&"</td><td align='center'>"&ours("WS_AttendanceOutEnrolTime1")&"</td><td align='center'>"&ours("WS_AttendanceOutEnrolTime1")&"</td></tr>"
	    ours.movenext
		loop
	  end if
	  response.write "</table><br><table width='100%' cellspacing=1 cellpadding=3 bgcolor='#613c25'><tr bgcolor='6C8DBE' class=td4><td colspan='7'>请假登记</td></tr><tr bgcolor='BF9B73' class='td4'><td align='center'>部门</td><td align='center'>姓名</td><td align='center'> 请假原因</td><td align='center'> 开始时间 </td><td align='center'> 结束时间 </td><td align='center'>状态</td></tr>"
	  if lers.recordcount<=0 then
	    response.Write "<tr><td bgcolor=FFFBE8 colspan=7 align=center>无请假记录</td></tr>"
	  else
	    do until lers.eof
		 Call WS_S.HX_OutUserInfo(lers("WS_AttendanceleaveEnrolReplyID"))
	  response.write "<tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td align='center'>"&Outdepartment& "</td><td align='center'>"&OutName&"</td><td align='center'>"&lers("WS_AttendanceleaveEnrolTYPE")&"</td><td align='center'>"&lers("WS_AttendanceleaveEnrolTime1")&"</td><td align='center'>"&lers("WS_AttendanceleaveEnrolTime1")&"</td><td align='center'>"
	  select case lers("WS_AttendanceLeaveEnrolFlag")
       case 0:response.Write "待批"
       case 1:response.Write "已批准"
	   case 2:response.Write "未批准"
	   case 3:response.write "已销假" 
  end select
  response.write "</td></tr>"
	    lers.movenext
		loop
	  end if
	  response.write "</table><br><table width='100%' cellspacing=1 cellpadding=3 bgcolor='#613c25'><tr bgcolor='6C8DBE' class=td4><td colspan='8'>出差登记</td></tr><tr bgcolor='BF9B73' class='td4'><td width='15%' align='center'>部门</td><td width='12%' align='center'>姓名</td><td width='16%' align='center'> 出差地点</td><td width='16%' align='center'>事因</td><td width='14%' align='center'> 开始时间 </td><td width='14%' align='center'> 结束时间 </td><td width='13%' align='center'>状态</td></tr>"
	  if aers.recordcount<=0 then
	    response.Write "<tr><td bgcolor=FFFBE8 colspan=8 align=center>无出差记录</td></tr>"
	  else
	    do until aers.eof
		 Call WS_S.HX_OutUserInfo(aers("WS_AttendanceEvectionEnrolReplyID"))
	  response.write "<tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td align='center'>"&Outdepartment&"</td><td align='center'>"&OutName&"</td><td align='center'>"&aers("WS_AttendanceEvectionEnrolADDRESS")&"</td><td align='center' title='"&aers("WS_AttendanceEvectionEnrolReason")&"'>"&left(aers("WS_AttendanceEvectionEnrolReason"),6)&"</td><td align='center'>"&aers("WS_AttendanceEvectionEnrolTime1")&"</td><td align='center'>"&aers("WS_AttendanceEvectionEnrolTime1")&"</td><td align='center'>"
	  select case aers("WS_AttendanceEvectionEnrolFlag")
       case 0:response.Write "待批"
       case 1:response.Write "已批准"
	   case 2:response.Write "未批准"
	   case 3:response.write "已销假" 
  end select
  response.write "</td></tr>"
	    aers.movenext
		loop
	  end if
	  response.write "</table></td></tr></table>"%>